file_path
stringlengths 32
153
| content
stringlengths 0
3.14M
|
---|---|
omniverse-code/kit/include/omni/ui/bind/DocVStack.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_VStack \
"Shortcut for Stack{eTopToBottom}. The widgets are placed in a column, with suitable sizes.\n"
#define OMNIUI_PYBIND_DOC_VStack_VStack "Construct a stack with the widgets placed in a column from top to bottom.\n"
|
omniverse-code/kit/include/omni/ui/bind/DocArrowHelper.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ArrowHelper \
"The ArrowHelper widget provides a colored rectangle to display.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_beginArrowWidth "This property holds the width of the begin arrow.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_beginArrowHeight "This property holds the height of the begin arrow.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_beginArrowType \
"This property holds the type of the begin arrow can only be eNone or eRrrow. By default, the arrow type is eNone.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_endArrowWidth "This property holds the width of the end arrow.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_endArrowHeight "This property holds the height of the end arrow.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_endArrowType \
"This property holds the type of the end arrow can only be eNone or eRrrow. By default, the arrow type is eNone.\n"
#define OMNIUI_PYBIND_DOC_ArrowHelper_ArrowHelper "Constructs ArrowHelper.\n"
|
omniverse-code/kit/include/omni/ui/bind/BindVGrid.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindGrid.h"
#include "BindUtils.h"
#include "DocVGrid.h"
#define OMNIUI_PYBIND_INIT_VGrid OMNIUI_PYBIND_INIT_Grid
#define OMNIUI_PYBIND_KWARGS_DOC_VGrid OMNIUI_PYBIND_KWARGS_DOC_Grid
|
omniverse-code/kit/include/omni/ui/bind/BindFloatField.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractField.h"
#include "BindUtils.h"
#include "DocFloatField.h"
#define OMNIUI_PYBIND_INIT_FloatField \
OMNIUI_PYBIND_INIT_AbstractField \
OMNIUI_PYBIND_INIT_CAST(precision, setPrecision, uint32_t)
#define OMNIUI_PYBIND_KWARGS_DOC_FloatField \
"\n `precision : uint32_t`\n " \
OMNIUI_PYBIND_DOC_FloatField_precision \
OMNIUI_PYBIND_KWARGS_DOC_AbstractField
|
omniverse-code/kit/include/omni/ui/bind/DocGrid.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Grid \
"Grid is a container that arranges its child views in a grid. The grid vertical/horizontal direction is the direction the grid size growing with creating more children.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Grid_CellSizeMode \
"The grid has two modes of working. When the current mode is eSizeFromCount, the grid computes the size of the cell using the number of columns/rows. When eCountFromSize, the size of the cells is always the same, but the number of columns varies depending on the grid's full size.\n"
#define OMNIUI_PYBIND_DOC_Grid_setComputedContentWidth \
"Reimplemented the method to indicate the width hint that represents the preferred size of the widget.\n"
#define OMNIUI_PYBIND_DOC_Grid_setComputedContentHeight \
"Reimplemented the method to indicate the height hint that represents the preferred size of the widget.\n"
#define OMNIUI_PYBIND_DOC_Grid_columnWidth \
"The width of the column. It's only possible to set it if the grid is vertical. Once it's set, the column count depends on the size of the widget.\n"
#define OMNIUI_PYBIND_DOC_Grid_rowHeight \
"The height of the row. It's only possible to set it if the grid is horizontal. Once it's set, the row count depends on the size of the widget.\n"
#define OMNIUI_PYBIND_DOC_Grid_columnCount \
"The number of columns. It's only possible to set it if the grid is vertical. Once it's set, the column width depends on the widget size.\n"
#define OMNIUI_PYBIND_DOC_Grid_rowCount \
"The number of rows. It's only possible to set it if the grid is horizontal. Once it's set, the row height depends on the widget size.\n"
#define OMNIUI_PYBIND_DOC_Grid_Grid \
"Constructor.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `direction :`\n" \
" Determines the direction the widget grows when adding more children.\n"
|
omniverse-code/kit/include/omni/ui/bind/DocVGrid.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_VGrid \
"Shortcut for Grid{eTopToBottom}. The grid grows from top to bottom with the widgets placed.\n"
#define OMNIUI_PYBIND_DOC_VGrid_VGrid "Construct a grid that grows from top to bottom with the widgets placed.\n"
|
omniverse-code/kit/include/omni/ui/bind/DocRectangle.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Rectangle \
"The Rectangle widget provides a colored rectangle to display.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Rectangle_Rectangle "Constructs Rectangle.\n"
|
omniverse-code/kit/include/omni/ui/bind/BindStyleContainer.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include <omni/ui/Api.h>
#include <omni/ui/StyleContainer.h>
#include <omni/ui/StyleStore.h>
#include <omni/ui/Widget.h>
#include <omni/ui/bind/Pybind.h>
OMNIUI_NAMESPACE_OPEN_SCOPE
/**
* @brief Converts the given python property and adds it to the style.
*
* Please see the description of setPythonStyle for the explanation why it's inline.
*/
inline void addPropertyToStyle(StyleContainer& style,
const std::string& scopeName,
const std::string& propertyName,
const pybind11::handle& propertyValue)
{
using namespace pybind11;
StyleFloatProperty floatEnum = StyleContainer::getPropertyEnumeration<StyleFloatProperty>(propertyName);
if (floatEnum != StyleFloatProperty::eCount)
{
if (isinstance<float_>(propertyValue) || isinstance<int_>(propertyValue))
{
style.merge({ scopeName, floatEnum, propertyValue.cast<float>() });
}
else if (isinstance<pybind11::str>(propertyValue))
{
style.merge({ scopeName, floatEnum, propertyValue.cast<std::string>().c_str() });
}
return;
}
StyleEnumProperty valueEnum = StyleContainer::getPropertyEnumeration<StyleEnumProperty>(propertyName);
if (valueEnum != StyleEnumProperty::eCount)
{
style.merge({ scopeName, valueEnum, propertyValue.cast<uint32_t>() });
return;
}
StyleStringProperty stringEnum = StyleContainer::getPropertyEnumeration<StyleStringProperty>(propertyName);
if (stringEnum != StyleStringProperty::eCount)
{
std::string value = propertyValue.cast<std::string>();
style.merge({ scopeName, stringEnum, value.c_str() });
return;
}
StyleColorProperty colorEnum = StyleContainer::getPropertyEnumeration<StyleColorProperty>(propertyName);
if (colorEnum != StyleColorProperty::eCount)
{
if (isinstance<int_>(propertyValue))
{
style.merge({ scopeName, colorEnum, propertyValue.cast<uint32_t>() });
}
else if (isinstance<pybind11::str>(propertyValue))
{
style.merge({ scopeName, colorEnum, propertyValue.cast<std::string>().c_str() });
}
}
}
inline StyleContainer getStyleContainer(const pybind11::handle& style)
{
using namespace pybind11;
StyleContainer convertedStyle;
for (const auto& scope : style.cast<dict>())
{
auto scopeName = scope.first.cast<std::string>();
const auto& scopeValue = scope.second;
if (isinstance<dict>(scopeValue))
{
/* It's a scope */
for (const auto& property : scopeValue.cast<dict>())
{
auto propertyName = property.first.cast<std::string>();
const auto& propertyValue = property.second;
addPropertyToStyle(convertedStyle, scopeName, propertyName, propertyValue);
}
}
else
{
/* It's a property */
addPropertyToStyle(convertedStyle, "", scopeName, scopeValue);
}
}
return convertedStyle;
}
/**
* @brief Converts Python style and applies it to the widget.
*
* In python we use regular dictionary as style. It can be like of this forms:
*
* {"Button::okButton:hovered": {"color": 0xff000000}}
* {"color": 0xff000000}
*
* Unlike C++ version, it supports multiple scopes at once:
*
* {"Button::red": {"color": 0xffff0000}, "Button::okButton:hovered": {"color": 0xff000000}}
*
* This function is inline because otherwise it would live in the omni.ui.python library and we would need to link all
* the python bindings libraries against omni.ui.python. We can't link python bindings to another python bindings. The
* best solution would be to create third library with this function.
*
* It's inline for OMNIUI_PYBIND_INIT_STYLES.
*/
inline void setWidgetStyle(Widget& widget, const pybind11::handle& style)
{
widget.setStyle(std::move(getStyleContainer(style)));
}
OMNIUI_API
pybind11::object convertStyleToPython(const std::shared_ptr<StyleContainer>& style);
/**
* @brief Opposite to setWidgetStyle. Returns python dict that represents the style.
*/
OMNIUI_API
pybind11::object getPythonStyle(Widget& widget);
/**
* @brief It returns the Python dict that is the style result of merging the
* styles of all the parents and the local style.
*/
OMNIUI_API
pybind11::object getResolvedPythonStyle(const std::shared_ptr<Widget>& widget);
OMNIUI_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/bind/DocCallbackBase.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_CallbackBase \
"Base object for callback containers.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/bind/BindRadioCollection.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindUtils.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_RadioCollection
#define OMNIUI_PYBIND_KWARGS_DOC_RadioCollection
// clang-format on
|
omniverse-code/kit/include/omni/ui/bind/DocCallbackHelper.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_CallbackHelper \
"Base class for the objects that should automatically clean up the callbacks. It collects all the callbacks created with OMNIUI_CALLBACK and is able to clean all of them. We use it to destroy the callbacks if the parent object is destroyed, and it helps to break circular references created by pybind11 because pybind11 can't use weak pointers.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/DrawList.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "DrawBuffer.h"
#include "DrawBufferIndex.h"
#include "Math.h"
#include <array>
#include <vector>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class AbstractDrawSystem;
struct DrawData
{
DrawBuffer** buffers = nullptr;
size_t bufferCount = 0;
operator bool() const
{
return buffers != nullptr && bufferCount != 0;
}
};
/**
* @brief The InvisibleButton widget provides a transparent command button.
*/
class OMNIUI_SCENE_CLASS_API DrawList
{
public:
enum LINE_FLAGS
{
LINE_FLAG_NONE = 0x0,
LINE_FLAG_BACK_CULLING = 0x1 << 0,
LINE_FLAG_FRONT_CULLING = 0x1 << 1,
};
OMNIUI_SCENE_API
DrawList();
OMNIUI_SCENE_API
~DrawList();
void destroy();
void addLine(const Vector3& begin, const Vector3& end, const Color4& color, float thickness);
void addRect(Float width, Float height, const Color4& color, const void* texture);
void addText(const char* text, const Vector3& point, const Color4& color, float size, uint32_t flag);
void addPolygonLines(const Vector3* points,
const Color4* colors,
const float* thicknesses,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
const uint32_t* flags,
size_t vertexCountSize);
void addPolygonMesh(const Vector4* points,
const Color4* colors,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
size_t vertexCountSize,
const Vector2* uvs = nullptr,
const void* const* textures = nullptr,
const void* const* resources = nullptr);
void addPolygonMesh(const Vector3* points,
const Color4* colors,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
size_t vertexCountSize,
const Vector2* uvs = nullptr,
const void* const* textures = nullptr,
const void* const* resources = nullptr);
void addPoints(const Vector4* positions, const Color4* colors, const float* sizes, size_t pointCount);
void addPoints(const Vector4* positions, const Color4& color, float size, size_t pointCount);
void addPoints(const Vector3* positions, const Color4* colors, const float* sizes, size_t pointCount);
void addPoints(const Vector3* positions, const Color4& color, float size, size_t pointCount);
void beginTransform(const Matrix44& matrix,
const DrawBufferIndex& index,
std::shared_ptr<TransformBasis> basis = nullptr);
DrawBufferIndex endTransform();
void beginFrame();
void endFrame();
/**
* @brief Clears the buffers of the given index. We use it when destroying items.
*/
void clearBuffers(DrawBufferIndex& index);
const DrawData& getDrawData() const;
/**
* @brief Return the number of buffers used. Using for unit testing.
*/
size_t getBufferCount() const;
private:
size_t _getBufferIndex(DrawBuffer::BufferType bufferType);
std::vector<DrawBufferIndex> m_currentBufferStack;
size_t m_maxBufferIndex;
std::vector<Matrix44> m_transformStack;
std::vector<std::shared_ptr<TransformBasis>> m_basisStack;
std::vector<std::unique_ptr<DrawBuffer>> m_buffers;
std::vector<DrawBuffer*> m_outputBuffers;
DrawData m_outputData;
DrawBufferIndex m_rootBufferIndex;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/AbstractDrawSystem.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "Math.h"
#include <stdint.h>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class DrawBuffer;
/**
* @brief The InvisibleButton widget provides a transparent command button.
*/
class OMNIUI_SCENE_CLASS_API AbstractDrawSystem
{
public:
OMNIUI_SCENE_API
virtual ~AbstractDrawSystem();
virtual void setup() = 0;
virtual void beginFrame() = 0;
virtual void render(const DrawBuffer* const* buffers,
size_t bufferCount,
const Matrix44& projection,
const Matrix44& view,
float width,
float height,
float dpiScale) = 0;
virtual void endFrame() = 0;
virtual void destroy() = 0;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Label.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
#include <omni/ui/Alignment.h>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* Defines a standard label for user interface items
*/
class OMNIUI_SCENE_CLASS_API Label : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Label);
public:
OMNIUI_SCENE_API
virtual ~Label();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
OMNIUI_SCENE_API
const AbstractGesture::GesturePayload* getGesturePayload() const override;
OMNIUI_SCENE_API
const AbstractGesture::GesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief This property holds the label's text.
*/
OMNIUI_PROPERTY(std::string, text, READ, getText, WRITE, setText, NOTIFY, setTextChangedFn);
/**
* @brief The color of the text
*/
OMNIUI_PROPERTY(Color4, color, DEFAULT, Color4{ 1.0 }, READ, getColor, WRITE, setColor);
/**
* @brief This property holds the alignment of the label's contents
* By default, the contents of the label are left-aligned and vertically-centered.
*/
OMNIUI_PROPERTY(Alignment, alignment, DEFAULT, Alignment::eLeftCenter, READ, getAlignment, WRITE, setAlignment);
/**
* @brief The font size
*/
OMNIUI_PROPERTY(float, size, DEFAULT, 12.0, READ, getSize, WRITE, setSize);
protected:
/**
* @brief A standard label for user interface items
*
* @param text The string with the text to display
*/
OMNIUI_SCENE_API
Label(const std::string& text);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/CameraModel.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractManipulatorModel.h"
#include "Math.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* - A model that holds projection and view matrices
*/
class OMNIUI_SCENE_CLASS_API CameraModel : public AbstractManipulatorModel
{
public:
/**
* @brief Initialize the camera with the given projection/view matrices
*/
OMNIUI_SCENE_API
CameraModel(const Matrix44& projection, const Matrix44& view);
// TODO: perspective/ortho with origin, direction, fov
OMNIUI_SCENE_API
~CameraModel() override;
/**
* @brief Returns the items that represents the identifier.
*/
OMNIUI_SCENE_API
std::shared_ptr<const AbstractManipulatorItem> getItem(const std::string& identifier) override;
/**
* @brief Returns the float values of the item.
*/
OMNIUI_SCENE_API
std::vector<Float> getAsFloats(const std::shared_ptr<const AbstractManipulatorItem>& item) override;
/**
* @brief Returns the int values of the item.
*/
OMNIUI_SCENE_API
std::vector<int64_t> getAsInts(const std::shared_ptr<const AbstractManipulatorItem>& item) override;
/**
* @brief Sets the float values of the item.
*/
OMNIUI_SCENE_API
void setFloats(const std::shared_ptr<const AbstractManipulatorItem>& item, std::vector<Float> value) override;
/**
* @brief Sets the int values of the item.
*/
OMNIUI_SCENE_API
void setInts(const std::shared_ptr<const AbstractManipulatorItem>& item, std::vector<int64_t> value) override;
/**
* @brief The camera projection matrix.
*/
OMNIUI_SCENE_API
virtual Matrix44 getProjection() const;
/**
* @brief The camera view matrix.
*/
OMNIUI_SCENE_API
virtual Matrix44 getView() const;
/**
* @brief Set the camera projection matrix.
*/
OMNIUI_SCENE_API
virtual void setProjection(const Matrix44& projection);
/**
* @brief Set the camera view matrix.
*/
OMNIUI_SCENE_API
virtual void setView(const Matrix44& view);
private:
class MatrixItem : public AbstractManipulatorItem
{
public:
MatrixItem(const Matrix44& matrix);
~MatrixItem() override;
const std::vector<Float>& getAsFloats() const;
Matrix44 getAsMatrix() const;
void setFloats(std::vector<Float>&& value);
void setMatrix(const Matrix44& matrix);
private:
std::vector<Float> m_floats;
};
std::shared_ptr<MatrixItem> m_projection;
std::shared_ptr<MatrixItem> m_view;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Rectangle.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class OMNIUI_SCENE_CLASS_API Rectangle : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Rectangle);
public:
class RectangleGesturePayload : public AbstractGesture::GesturePayload
{
public:
Float s = 0.0;
Float t = 0.0;
Float movedS = 0.0;
Float movedT = 0.0;
Vector3 moved = Vector3{ 0.0 };
};
OMNIUI_SCENE_API
virtual ~Rectangle();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const RectangleGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const RectangleGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief The size of the rectangle
*/
OMNIUI_PROPERTY(Float, width, READ, getWidth, WRITE, setWidth, PROTECTED, NOTIFY, _setWidthChangedFn);
/**
* @brief The size of the rectangle
*/
OMNIUI_PROPERTY(Float, height, READ, getHeight, WRITE, setHeight, PROTECTED, NOTIFY, _setHeightChangedFn);
/**
* @brief The thickness of the line
*/
OMNIUI_PROPERTY(
float, thickness, DEFAULT, 1.0, READ, getThickness, WRITE, setThickness, PROTECTED, NOTIFY, _setThicknessChangedFn);
/**
* @brief The thickness of the line for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionThickness,
DEFAULT,
0.0,
READ,
getIntersectionThickness,
WRITE,
setIntersectionThickness,
PROTECTED,
NOTIFY,
_setIntersectionThicknessChangedFn);
/**
* @brief The color of the line
*/
OMNIUI_PROPERTY(
Color4, color, DEFAULT, Color4{ 1.0 }, READ, getColor, WRITE, setColor, PROTECTED, NOTIFY, _setColorChangedFn);
/**
* @brief When true, it's a line. When false it's a mesh.
*/
OMNIUI_PROPERTY(
bool, wireframe, DEFAULT, false, READ, isWireframe, WRITE, setWireframe, PROTECTED, NOTIFY, _setWireframeChangedFn);
/**
* @brief The axis the rectangle is perpendicular to
*/
OMNIUI_PROPERTY(uint8_t, axis, DEFAULT, 2, READ, getAxis, WRITE, setAxis, PROTECTED, NOTIFY, _setAxisChangedFn);
protected:
/**
* @brief Construct a rectangle with predefined size.
*
* @param width The size of the rectangle
* @param height The size of the rectangle
*/
OMNIUI_SCENE_API
Rectangle(Float width = 1.0, Float height = 1.0);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _dirtyCache();
virtual void _rebuildCache();
std::unique_ptr<RectangleGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<RectangleGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
// Cache to avoid computation every frame
std::vector<Vector3> m_cachedPoints;
std::vector<Color4> m_cachedColors;
std::vector<uint32_t> m_cachedVertexIndices;
std::vector<uint32_t> m_cachedVertexCounts;
std::vector<float> m_cachedThicknesses;
bool m_cacheIsDirty = true;
bool m_intersectionThicknessExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Manipulator.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractContainer.h"
#include "AbstractGesture.h"
#include "AbstractManipulatorModel.h"
#include "ManipulatorModelHelper.h"
#include <unordered_map>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class ManipulatorGesture;
/**
* @brief The base object for the custom manipulators
*/
class OMNIUI_SCENE_CLASS_API Manipulator : public AbstractContainer, public ManipulatorModelHelper
{
OMNIUI_SCENE_OBJECT(Manipulator);
public:
OMNIUI_SCENE_API
virtual ~Manipulator();
/**
* @brief Called when Manipulator is dirty to build the content.
*/
OMNIUI_SCENE_API
virtual void onBuild();
/**
* @brief Make Manipulator dirty so onBuild will be executed in
* _preDrawContent
*/
OMNIUI_SCENE_API
void invalidate();
/**
* @brief Called by the model when the model value is changed. The class should react to the changes.
*
* @param item The item in the model that is changed. If it's NULL, the root is changed.
*/
OMNIUI_SCENE_API
void onModelUpdated(const std::shared_ptr<const AbstractManipulatorModel::AbstractManipulatorItem>& item) override;
/**
* @brief All the gestures assigned to this manipulator
*/
OMNIUI_SCENE_API
const std::vector<std::shared_ptr<ManipulatorGesture>>& getGestures() const;
/**
* @brief Replace the gestures of the manipulator
*/
OMNIUI_SCENE_API
void setGestures(const std::vector<std::shared_ptr<ManipulatorGesture>>& gestures);
/**
* @brief Add a single gesture to the manipulator
*/
OMNIUI_SCENE_API
void addGesture(const std::shared_ptr<ManipulatorGesture>& gesture);
/**
* @brief Called when Manipulator is dirty to build the content. It's
* another way to build the manipulator's content on the case the user
* doesn't want to reimplement the class.
*/
OMNIUI_CALLBACK(OnBuild, void, Manipulator const*);
protected:
/**
* @brief Constructor
*/
OMNIUI_SCENE_API
Manipulator();
OMNIUI_SCENE_API
void _preDrawContent(
const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height) override;
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
OMNIUI_SCENE_API
void _postDrawContent(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Process the ManipulatorGestures that can be casted to the given type
*/
template <class Gesture>
void _processGesture(GestureState state, const std::shared_ptr<AbstractGesture::GesturePayload>& gesturePayload)
{
if (!gesturePayload)
{
return;
}
for (auto& gesture : m_gestures)
{
auto castedGesture = std::dynamic_pointer_cast<Gesture>(gesture);
if (castedGesture)
{
castedGesture->_processWithGesturePayload(this, state, gesturePayload);
}
}
}
std::vector<std::shared_ptr<ManipulatorGesture>> m_gestures;
private:
bool m_dirty = true;
// We need it to keep the old children. We remove them in _postDrawContent.
std::vector<std::shared_ptr<AbstractItem>> m_oldChildren;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Api.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#ifdef _WIN32
# define OMNIUI_SCENE_EXPORT __declspec(dllexport)
# define OMNIUI_SCENE_IMPORT __declspec(dllimport)
# define OMNIUI_SCENE_CLASS_EXPORT
#else
# define OMNIUI_SCENE_EXPORT __attribute__((visibility("default")))
# define OMNIUI_SCENE_IMPORT
# define OMNIUI_SCENE_CLASS_EXPORT __attribute__((visibility("default")))
#endif
#if defined(OMNIUI_SCENE_STATIC)
# define OMNIUI_SCENE_API
# define OMNIUI_SCENE_CLASS_API
#else
# if defined(OMNIUI_SCENE_EXPORTS)
# define OMNIUI_SCENE_API OMNIUI_SCENE_EXPORT
# define OMNIUI_SCENE_CLASS_API OMNIUI_SCENE_CLASS_EXPORT
# else
# define OMNIUI_SCENE_API OMNIUI_SCENE_IMPORT
# define OMNIUI_SCENE_CLASS_API
# endif
#endif
#define OMNIUI_SCENE_NS omni::ui::scene
#define OMNIUI_SCENE_NAMESPACE_USING_DIRECTIVE using namespace OMNIUI_SCENE_NS;
#define OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE \
namespace omni \
{ \
namespace ui \
{ \
namespace scene \
{
#define OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE \
} \
} \
}
|
omniverse-code/kit/include/omni/ui/scene/Curve.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
#include <array>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief Represents the curve.
*/
class OMNIUI_SCENE_CLASS_API Curve : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Curve);
public:
class CurveGesturePayload : public AbstractGesture::GesturePayload
{
public:
// The normalized distance [0..1] along the curve from begin of the
// segment to itemClosestPoint
Float curveDistance = 0.0;
// The difference between rayClosestPoint in the previous frame and
// rayClosestPoint in current frame.
Vector3 moved = Vector3{ 0.0 };
// The difference between curveDistance in the previous frame and
// curveDistance in current frame.
Float movedDistance = 0.0;
};
OMNIUI_SCENE_API
virtual ~Curve();
enum class CurveType
{
linear,
cubic,
};
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const CurveGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const CurveGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief The list of positions which defines the curve. It has at least two positions. The curve has
* `len(positions)-1` segments.
*/
OMNIUI_PROPERTY(std::vector<Vector3>, positions, READ, getPositions, WRITE, setPositions, NOTIFY, _setPositionsChangedFn);
/**
* @brief The list of colors which defines color per vertex. It has the same length as positions
*/
OMNIUI_PROPERTY(std::vector<Color4>, colors, READ, getColors, WRITE, setColors, NOTIFY, _setColorsChangedFn);
/**
* @brief The list of thicknesses which defines thickness per vertex. It has the same length as positions
*/
OMNIUI_PROPERTY(
std::vector<float>, thicknesses, READ, getThicknesses, WRITE, setThicknesses, NOTIFY, _setThicknessesChangedFn);
/**
* @brief The thickness of the line for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionThickness,
DEFAULT,
0.0,
READ,
getIntersectionThickness,
WRITE,
setIntersectionThickness,
PROTECTED,
NOTIFY,
_setIntersectionThicknessChangedFn);
/**
* @brief The curve interpolation type
*/
OMNIUI_PROPERTY(CurveType,
curveType,
DEFAULT,
CurveType::cubic,
READ,
getCurveType,
WRITE,
setCurveType,
NOTIFY,
_setCurveTypeChangedFn);
/**
* @brief The number of points per curve segment. It can't be less than 2
*/
OMNIUI_PROPERTY(
uint16_t, tessellation, DEFAULT, 9, READ, getTessellation, WRITE, setTessellation, NOTIFY, _setTessellationChangedFn);
protected:
/**
* @brief Constructs Curve
* @param positions List of positions
*/
OMNIUI_SCENE_API
Curve(const std::vector<Vector3>& positions = {});
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _dirtyCache();
void _rebuildCache();
/**
* @brief Compute curve positions with input 4 vertices and tessellation
* @param p0 start position
* @param p1 second control position
* @param p2 thrid constrol position
* @param p3 end position
* @param tessellation tessellation of the curve
*/
void _computeCurvePoses(const Vector3 p0,
const Vector3 p1,
const Vector3 p2,
const Vector3 p3,
const uint16_t tessellation,
std::vector<Vector3>& poses);
/**
* @brief Interpolate float with start and end floats into segment sized floats
* @param start start float
* @param end end float
* @param segment size of segment
* @param result the resulted vector of the interpolated floats. It includes the start, but not the end float
*/
void _interpolateFloat(float start, float end, size_t segment, std::vector<float>& result);
/**
* @brief Interpolate color with start and end colors into segment sized colors
* @param start start color
* @param end end color
* @param segment size of segment
* @param result the resulted vector of the interpolated colors. It includes the start, but not the end color
*/
void _interpolateColor(Color4 start, Color4 end, size_t segment, std::vector<Color4>& result);
// Cache to avoid computation every frame
std::vector<Vector3> m_cachedPositions;
std::vector<Color4> m_cachedColors;
std::vector<uint32_t> m_cachedVertexIndices;
std::vector<uint32_t> m_cachedVertexCounts;
std::vector<uint32_t> m_cachedFlags;
std::vector<float> m_cachedThicknesses;
// accumulated length from the start of the curve till the current vertex
std::vector<float> m_cachedLengths;
bool m_cacheIsDirty = true;
std::unique_ptr<CurveGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<CurveGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
bool m_intersectionThicknessExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/TexturedMesh.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "ImageHelper.h"
#include "PolygonMesh.h"
#include "Object.h"
OMNIUI_NAMESPACE_OPEN_SCOPE
class ImageProvider;
OMNIUI_NAMESPACE_CLOSE_SCOPE
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The shape for free-form textures. It supports both ImageProvider and
* URL. Basically it's PolygonMesh with the ability to use images.
*
* TODO: Tiling:
* We use the tiling provided by ImGui. In the future we can implement it
* when we need it.
*
* TODO: Alpha behavior:
* It should behave exactly like sc.Image. We can add a property for it later if
* we need it.
*/
class OMNIUI_SCENE_CLASS_API TexturedMesh : public PolygonMesh, public ImageHelper
{
OMNIUI_SCENE_OBJECT(TexturedMesh);
public:
class TexturedMeshGesturePayload : public PolygonMesh::PolygonMeshGesturePayload
{
public:
// The coords of the intersection in the space of the texture.
Float u = 0.0;
Float v = 0.0;
};
OMNIUI_SCENE_API
virtual ~TexturedMesh();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const TexturedMeshGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const TexturedMeshGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The texture coordinates.
*
* The number of elements corresponds to the face-varying interpolation: One
* element for each of the face-vertices that define the mesh topology.
*/
OMNIUI_PROPERTY(std::vector<Vector2>, uvs, GET_VALUE, getUvs, WRITE, setUvs, PROTECTED, NOTIFY, _setUvsChangedFn);
/**
* @brief This property holds the image URL. It can be an `omni:` path, a `file:` path, a direct path or the path
* relative to the application root directory.
*/
OMNIUI_PROPERTY(
std::string, sourceUrl, READ, getSourceUrl, WRITE, setSourceUrl, PROTECTED, NOTIFY, _setSourceUrlChangedFn);
/**
* @brief This property holds the image provider. It can be an `omni:` path, a `file:` path, a direct path or the
* path relative to the application root directory.
*/
OMNIUI_PROPERTY(std::shared_ptr<ImageProvider>,
imageProvider,
READ,
getImageProvider,
WRITE,
setImageProvider,
PROTECTED,
NOTIFY,
_setImageProviderChangedFn);
protected:
/**
* @brief Create with the given URL
*/
OMNIUI_SCENE_API
TexturedMesh(const std::string& sourceUrl,
const std::vector<Vector2>& uvs,
const std::vector<Vector3>& positions,
const std::vector<Color4>& colors,
const std::vector<uint32_t>& vertexCounts,
const std::vector<uint32_t>& vertexIndices,
bool legacyFlippedV = true);
/**
* @brief Create with the given provider
*/
OMNIUI_SCENE_API
TexturedMesh(const std::shared_ptr<ImageProvider>& imageProvider,
const std::vector<Vector2>& uvs,
const std::vector<Vector3>& positions,
const std::vector<Color4>& colors,
const std::vector<uint32_t>& vertexCounts,
const std::vector<uint32_t>& vertexIndices,
bool legacyFlippedV = true);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _initialize(const std::vector<Vector2>& uvs);
void _uvsChanged();
std::unique_ptr<TexturedMeshGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<TexturedMeshGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
const bool m_legacyFlippedV;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/DragGesture.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Object.h"
#include "ShapeGesture.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The gesture that provides a way to capture click-and-drag mouse
* event.
*/
class OMNIUI_SCENE_CLASS_API DragGesture : public ShapeGesture
{
OMNIUI_GESTURE_OBJECT(DragGesture)
public:
OMNIUI_SCENE_API
~DragGesture();
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Process the gesture and call callbacks if necessary.
*/
OMNIUI_SCENE_API
void process() override;
/**
* @brief Called if the callback is not set when the user clicks the mouse
* button.
*/
OMNIUI_SCENE_API
virtual void onBegan();
/**
* @brief Called if the callback is not set when the user moves the clicked
* button.
*/
OMNIUI_SCENE_API
virtual void onChanged();
/**
* @brief Called if the callback is not set when the user releases the mouse
* button.
*/
OMNIUI_SCENE_API
virtual void onEnded();
/**
* @brief Mouse button that should be active to start the gesture
*/
OMNIUI_PROPERTY(uint32_t, mouseButton, DEFAULT, 0, READ, getMouseButton, WRITE, setMouseButton);
/**
* @brief The keyboard modifier that should be active ti start the gesture
*/
OMNIUI_PROPERTY(uint32_t, modifiers, DEFAULT, UINT32_MAX, READ, getModifiers, WRITE, setModifiers);
/**
* @brief The check_mouse_moved property is a boolean flag that determines
* whether the DragGesture should verify if the 2D screen position of the
* mouse has changed before invoking the on_changed method. This property
* is essential in a 3D environment, as changes in the camera position can
* result in the mouse pointing to different locations in the 3D world even
* when the 2D screen position remains unchanged.
*
* Usage
*
* When check_mouse_moved is set to True, the DragGesture will only
* call the on_changed method if the actual 2D screen position of the
* mouse has changed. This can be useful when you want to ensure that the
* on_changed method is only triggered when there is a genuine change in
* the mouse's 2D screen position.
*
* If check_mouse_moved is set to False, the DragGesture will not
* check for changes in the mouse's 2D screen position before calling the
* on_changed method. This can be useful when you want the on_changed
* method to be invoked even if the mouse's 2D screen position hasn't
* changed, such as when the camera position is altered, and the mouse now
* points to a different location in the 3D world.
*/
OMNIUI_PROPERTY(bool, checkMouseMoved, DEFAULT, false, READ, isCheckMouseMoved, WRITE, setCheckMouseMoved);
/**
* @brief Called when the user starts drag
*/
OMNIUI_CALLBACK(OnBegan, void, AbstractShape const*);
/**
* @brief Called when the user is dragging
*/
OMNIUI_CALLBACK(OnChanged, void, AbstractShape const*);
/**
* @brief Called when the user releases the mouse and finishes the drag
*/
OMNIUI_CALLBACK(OnEnded, void, AbstractShape const*);
protected:
/**
* @brief Construct the gesture to track mouse drags.
*/
OMNIUI_SCENE_API
DragGesture();
private:
Vector3 m_itemLastPoint = Vector3{ 0.0 };
Vector3 m_rayLastPoint = Vector3{ 0.0 };
Vector2 m_mouseLast = Vector3{ 0.0 };
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/AbstractItem.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "Math.h"
#include "Object.h"
#include "Space.h"
#include <omni/ui/Callback.h>
#include <omni/ui/Property.h>
#include <memory>
#include <unordered_set>
OMNIUI_NAMESPACE_USING_DIRECTIVE
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class Scene;
class SceneView;
class DrawList;
class GestureManager;
struct MouseInput
{
enum class InputFlag : uint32_t
{
eViewHovered = (1 << 0),
};
MouseInput(const Vector2& inMouse = {},
const Vector2& inMouseWheel = {},
const Vector3& inMouseOrigin = {},
const Vector3& inMouseDirection = {},
const uint32_t& inModifiers = {},
const uint32_t& inClicked = {},
const uint32_t& inDoubleClicked = {},
const uint32_t& inReleased = {},
const uint32_t& inDown = {},
const uint32_t& inFlags = {})
: mouse{ inMouse },
mouseWheel{ inMouseWheel },
mouseOrigin{ inMouseOrigin },
mouseDirection{ inMouseDirection },
modifiers{ inModifiers },
clicked{ inClicked },
doubleClicked{ inDoubleClicked },
released{ inReleased },
down{ inDown },
flags{ inFlags }
{
}
Vector2 mouse;
Vector2 mouseWheel;
Vector3 mouseOrigin;
Vector3 mouseDirection;
uint32_t modifiers;
uint32_t clicked;
uint32_t doubleClicked;
uint32_t released;
uint32_t down;
uint32_t flags;
};
class OMNIUI_SCENE_CLASS_API AbstractItem : public std::enable_shared_from_this<AbstractItem>,
protected omni::ui::CallbackHelper<AbstractItem>
{
public:
OMNIUI_SCENE_API
virtual ~AbstractItem();
/**
* @brief Removes all the callbacks and circular references.
*/
OMNIUI_SCENE_API
virtual void destroy();
// We assume that all the operations with all the items should be performed with smart pointers because we have
// parent-child relationships, and we automatically put new items to parents in the create method of every item.
// If the object is copied or moved, it will break the Item-Container hierarchy.
// No copy
AbstractItem(const AbstractItem&) = delete;
// No copy-assignment
AbstractItem& operator=(const AbstractItem&) = delete;
// No move constructor and no move-assignments are allowed because of the C++ standard
OMNIUI_SCENE_API
void preDrawContent(const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height);
OMNIUI_SCENE_API
void drawContent(const Matrix44& projection, const Matrix44& view);
OMNIUI_SCENE_API
void postDrawContent(const Matrix44& projection, const Matrix44& view);
/**
* @brief Transform the given point from the coordinate system fromspace to
* the coordinate system tospace.
*/
OMNIUI_SCENE_API
virtual Vector3 transformSpace(Space fromSpace, Space toSpace, const Vector3& point) const;
/**
* @brief Transform the given vector from the coordinate system fromspace to
* the coordinate system tospace.
*/
OMNIUI_SCENE_API
virtual Vector4 transformSpace(Space fromSpace, Space toSpace, const Vector4& vector) const;
/**
* @brief Calculate the effective visibility of this prim, as defined by its
* most ancestral invisible opinion, if any.
*/
OMNIUI_SCENE_API
bool computeVisibility() const;
OMNIUI_PROPERTY(const AbstractContainer*, parent, DEFAULT, nullptr, READ_VALUE, getParent, PROTECTED, WRITE, _setParent);
OMNIUI_PROPERTY(const Scene*, scene, DEFAULT, nullptr, PROTECTED, READ_VALUE, _getScene, WRITE, setScene);
/**
* @brief The current SceneView this item is parented to.
*/
OMNIUI_PROPERTY(SceneView const*, sceneView, DEFAULT, nullptr, READ_VALUE, getSceneView, PROTECTED, WRITE, _setSceneView);
/**
* @brief This property holds whether the item is visible.
*/
OMNIUI_PROPERTY(
bool, visible, DEFAULT, true, READ, isVisible, WRITE, setVisible, PROTECTED, NOTIFY, _setVisibleChangedFn);
protected:
friend class AbstractContainer;
friend class SceneContainerStack;
OMNIUI_SCENE_API
virtual void _preDrawContent(
const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height);
OMNIUI_SCENE_API
virtual void _drawContent(const Matrix44& projection, const Matrix44& view) = 0;
OMNIUI_SCENE_API
virtual void _postDrawContent(const Matrix44& projection, const Matrix44& view);
OMNIUI_SCENE_API
AbstractItem();
OMNIUI_SCENE_API
DrawList* _getDrawList() const;
OMNIUI_SCENE_API
virtual void _collectManagers(std::unordered_set<GestureManager*>& managers) const = 0;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ManipulatorModelHelper.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractManipulatorModel.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The ManipulatorModelHelper class provides the basic model functionality.
*
* TODO: It's very similar to ValueModelHelper. We need to template it. It's not templated now because we need a good
* solution for pybind11. Pybind11 doesn't like templated classes.
*/
class OMNIUI_SCENE_CLASS_API ManipulatorModelHelper
{
public:
OMNIUI_SCENE_API
virtual ~ManipulatorModelHelper();
/**
* @brief Called by the model when the model value is changed. The class should react to the changes.
*
* @param item The item in the model that is changed. If it's NULL, the root is changed.
*/
OMNIUI_SCENE_API
virtual void onModelUpdated(const std::shared_ptr<const AbstractManipulatorModel::AbstractManipulatorItem>& item) = 0;
/**
* @brief Set the current model.
*/
OMNIUI_SCENE_API
virtual void setModel(const std::shared_ptr<AbstractManipulatorModel>& model);
/**
* @brief Returns the current model.
*/
OMNIUI_SCENE_API
virtual const std::shared_ptr<AbstractManipulatorModel>& getModel() const;
protected:
OMNIUI_SCENE_API
ManipulatorModelHelper(const std::shared_ptr<AbstractManipulatorModel>& model);
private:
std::shared_ptr<AbstractManipulatorModel> m_model = {};
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Points.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief Represents the point cloud.
*/
class OMNIUI_SCENE_CLASS_API Points : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Points);
public:
class PointsGesturePayload : public AbstractGesture::GesturePayload
{
public:
Float distanceToPoint = Float(0.0);
Vector3 moved = Vector3{ 0.0 };
uint32_t closestPoint = UINT32_MAX;
};
OMNIUI_SCENE_API
virtual ~Points();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const PointsGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const PointsGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief List with positions of the points
*/
OMNIUI_PROPERTY(std::vector<Vector3>, positions, READ, getPositions, WRITE, setPositions);
/**
* @brief List of colors of the points
*/
OMNIUI_PROPERTY(std::vector<Color4>, colors, READ, getColors, WRITE, setColors);
/**
* @brief List of point sizes
*/
OMNIUI_PROPERTY(std::vector<float>, sizes, READ, getSizes, WRITE, setSizes);
/**
* @brief The size of the points for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionSize,
DEFAULT,
0.0,
READ,
getIntersectionSize,
WRITE,
setIntersectionSize,
PROTECTED,
NOTIFY,
_setIntersectionSizeChangedFn);
protected:
/**
* @brief Constructs the point cloud object
*
* @param positions List of positions
*/
OMNIUI_SCENE_API
Points(const std::vector<Vector3>& positions = {});
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
std::unique_ptr<PointsGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<PointsGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
bool m_intersectionSizeExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Space.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include <string>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief 3D positions and transformations exist within coordinate systems
* called spaces.
*/
enum class Space
{
eCurrent = 0,
eWorld,
eObject,
eNdc,
eScreen,
};
/**
* @brief Get the string with the name of the given space
*/
const std::string& getSpaceName(Space space);
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Math.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include <glm/glm/glm.hpp>
#define _USE_MATH_DEFINES
#include <math.h>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
// Using double as default float type
using Float = double;
// TODO: This is a temporary placeholder. We need to implement all of this.
using Color4 = glm::vec<4, Float, glm::defaultp>;
using Vector2 = glm::vec<2, Float, glm::defaultp>;
using Vector3 = glm::vec<3, Float, glm::defaultp>;
using Vector4 = glm::vec<4, Float, glm::defaultp>;
/**
* @brief Stores a 4x4 matrix of double elements. A basic type.
*
* Matrices are defined to be in row-major order.
*
* The matrix mode is required to define the matrix that resets the
* transformation to fit the geometry into NDC, Screen space, or rotate it to
* the camera direction.
*/
class Matrix44 : public glm::mat<4, 4, Float, glm::defaultp>
{
using BaseType = glm::mat<4, 4, Float, glm::defaultp>;
public:
// Constructor
template <typename... Args>
Matrix44(Args... args) : BaseType{ args... }
{
}
// TODO: getTranslate
// TODO: getRotate
// TODO: getScale
OMNIUI_SCENE_API
Matrix44 getInverse() const;
/**
* @brief Test this matrix for equality against another one
*/
OMNIUI_SCENE_API
inline bool operator == (const Matrix44& rhs) const {
return static_cast<const BaseType&>(*this) == static_cast<const BaseType&>(rhs);
}
/**
* @brief Test this matrix for inequality against another one
*/
OMNIUI_SCENE_API
inline bool operator != (const Matrix44& rhs) const {
return static_cast<const BaseType&>(*this) != static_cast<const BaseType&>(rhs);
}
/**
* @brief Rotates the matrix to be aligned with the camera
*
* @param view The view matrix of the camera
*/
OMNIUI_SCENE_API
Matrix44& setLookAtView(Matrix44 view);
/**
* @brief Creates a matrix to specify a translation at the given coordinates
*/
OMNIUI_SCENE_API
static Matrix44 getTranslationMatrix(Float x, Float y, Float z);
/**
* @brief Creates a matrix to specify a rotation around each axis
*
* @param degrees true if the angles are specified in degrees
*/
OMNIUI_SCENE_API
static Matrix44 getRotationMatrix(Float x, Float y, Float z, bool degrees = false);
/**
* @brief Creates a matrix to specify a scaling with the given scale factor per axis
*/
OMNIUI_SCENE_API
static Matrix44 getScaleMatrix(Float x, Float y, Float z);
};
void createRay(const Matrix44& projection, const Matrix44& view, const Vector2& mouse, Vector3* rayOrigin, Vector3* rayDir);
bool lineLineFindClosestPoints(const Vector3& p11,
const Vector3& p12,
const Vector3& p21,
const Vector3& p22,
Vector3* closest1,
Vector3* closest2,
Float* t1,
Float* t2);
bool lineSegFindClosestPoints(const Vector3& p11,
const Vector3& p12,
const Vector3& p21,
const Vector3& p22,
Vector3* closest1,
Vector3* closest2,
Float* t1,
Float* t2);
bool raySegFindClosestPoints(const Vector3& rayOrigin,
const Vector3& rayDir,
const Vector3& p0,
const Vector3& p1,
Vector3* rayPoint,
Vector3* segPoint,
Float* rayDistance,
Float* segDistance);
bool raySegPlaneGesturePayload(const Vector3& rayOrigin,
const Vector3& rayDir,
const Vector3& p,
const Vector3& v1,
const Vector3& v2,
Vector3* gesturePayload,
Float* s,
Float* t);
void raySegFindClosestPoint(const Vector3& rayOrigin, const Vector3& rayDir, const Vector3& p, Vector3* closest, Float* t);
Float screenSpaceDistance(
const Vector3& p1, const Vector3& p2, const Matrix44& projection, const Matrix44& view, const Vector2& frameSize);
template <typename T>
inline void _ensureCapacity(T& buffer, size_t capacity)
{
if (buffer.capacity() < capacity)
{
buffer.reserve(capacity);
}
}
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/TransformBasis.h | // Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Math.h"
#include <memory>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief A basis for mutating the transform space of a omni::ui::scene::Transform object.
*
* This class can be subclassed to implement custom space transformations. Transform objects containing
* a TransformBasis will base their transform off of the space described therein.
*/
class OMNIUI_SCENE_CLASS_API TransformBasis : public std::enable_shared_from_this<TransformBasis>
{
public:
OMNIUI_SCENE_API
virtual ~TransformBasis();
/**
* @brief Given a world-space transform matrix, return a matrix describing the transform from the supplied
* matrix into the space described by this basis object.
*
* @param other The world-space transform to convert
* @return Matrix44 A transform representing the supplied matrix in the space described by this basis object
*/
OMNIUI_SCENE_API
Matrix44 convertFromWorld(const Matrix44& other);
/**
* @brief Get a world-space matrix describing the origin point of the space described
*
* @return Matrix44 the transformation matrix needed to convert to the described space's coordinates
*/
OMNIUI_SCENE_API
virtual Matrix44 getMatrix() = 0;
protected:
friend class Transform;
/**
* @brief Reimplement if your TransformBasis subclass needs to know when it's been attached to a transform
*
*/
OMNIUI_SCENE_API
virtual void _attachToTransform();
/**
* @brief Reimplement if your TransformBasis subclass needs to know when it's been detached from a transform
*
*/
OMNIUI_SCENE_API
virtual void _detachFromTransform();
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/SceneView.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractItem.h"
#include "ManipulatorModelHelper.h"
#include <omni/ui/Widget.h>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class AbstractDrawSystem;
class Scene;
class SceneViewPrivate;
/**
* @brief The widget to render omni.ui.scene.
*/
class OMNIUI_SCENE_CLASS_API SceneView : public Widget, public ManipulatorModelHelper
{
OMNIUI_OBJECT(SceneView)
public:
enum class AspectRatioPolicy : uint8_t
{
eStretch = 0,
ePreserveAspectFit,
ePreserveAspectCrop,
ePreserveAspectVertical,
ePreserveAspectHorizontal,
};
OMNIUI_SCENE_API
~SceneView() override;
/**
* @brief The camera projection matrix. It's a shortcut for
* Matrix44(SceneView.model.get_as_floats("projection"))
*/
OMNIUI_SCENE_API
const Matrix44& getProjection() const;
/**
* @brief The camera view matrix. It's a shortcut for
* Matrix44(SceneView.model.get_as_floats("view"))
*/
OMNIUI_SCENE_API
const Matrix44& getView() const;
/**
* @brief Called by the model when the model value is changed. The class should react to the changes.
*
* @param item The item in the model that is changed. If it's NULL, the root is changed.
*/
OMNIUI_SCENE_API
void onModelUpdated(const std::shared_ptr<const AbstractManipulatorModel::AbstractManipulatorItem>& item) override;
/**
* @brief Convert NDC 2D [-1..1] coordinates to 3D ray.
*/
OMNIUI_SCENE_API
void getRayFromNdc(const Vector2& ndc, Vector3* rayOrigin, Vector3* rayDirection) const;
/**
* @brief The container that holds the shapes, gestures and managers.
*/
OMNIUI_PROPERTY(std::shared_ptr<Scene>, scene, READ, getScene, WRITE, setScene, PROTECTED, NOTIFY, _setSceneChangedFn);
/**
* @brief Aspect ratio of the rendering screen. This screen will be fit to the widget.
*
* SceneView simulates the behavior of the Kit viewport where the rendered
* image (screen) fits into the viewport (widget), and the camera has
* multiple policies that modify the camera projection matrix's aspect ratio
* to match it to the screen aspect ratio.
*
* When screen_aspect_ratio is 0, Screen size matches the Widget bounds.
*
* \internal
* +-Widget-------------+
* | |
* +-Screen-------------+
* | |
* | +----+ |
* | / /| |
* | +----+ | |
* | | | + |
* | | |/ |
* | +----+ |
* | |
* +--------------------+
* | |
* +--------------------+
* \endinternal
*/
OMNIUI_PROPERTY(float, screenAspectRatio, DEFAULT, 0.0, READ, getScreenAspectRatio, WRITE, setScreenAspectRatio);
/**
* @brief When it's false, the mouse events from other widgets inside the
* bounds are ignored. We need it to filter out mouse events from mouse
* events of widgets in `ui.VStack(content_clipping=1)`.
*/
OMNIUI_PROPERTY(bool, childWindowsInput, DEFAULT, true, READ, isChildWindowsInput, WRITE, setChildWindowsInput);
/**
* @brief Define what happens when the aspect ratio of the camera is
* different from the aspect ratio of the widget.
*/
OMNIUI_PROPERTY(AspectRatioPolicy,
aspectRatioPolicy,
DEFAULT,
AspectRatioPolicy::ePreserveAspectHorizontal,
READ,
getAspectRatioPolicy,
WRITE,
setAspectRatioPolicy);
Matrix44 getAmendedProjection() const;
OMNIUI_SCENE_API
virtual uint32_t getTextureUsageFlags() const {
return 0;
}
protected:
/**
* Constructor.
*/
OMNIUI_SCENE_API
SceneView(const std::shared_ptr<AbstractManipulatorModel>& model = nullptr);
/**
* @brief Creates DrawSystem. By default creates ImGuiDrawSystem. The
* developer can reimplement it to use a custom backend.
*/
OMNIUI_SCENE_API
virtual std::unique_ptr<AbstractDrawSystem> _createDrawSystem() const;
/**
* @brief Returns the mouse input object that has the information about 3D
* position, orientation, buttons, etc. By default it takes the information
* from ImGui, but the developer can override it to use a custom input
* provider.
*/
OMNIUI_SCENE_API
virtual MouseInput _captureInput(float width, float height, const Matrix44& view, const Matrix44& projection) const;
/**
* @brief Reimplemented the rendering code of the widget.
*
* @see Widget::_drawContent
*/
OMNIUI_SCENE_API
void _drawContent(float elapsedTime) override;
protected:
std::unique_ptr<AbstractDrawSystem> m_draw;
// Projection-view cache to avoid querying the model every frame.
// The camera projection.
Matrix44 m_projection;
// The camera transform.
Matrix44 m_view;
std::unique_ptr<SceneViewPrivate> m_prv;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Arc.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Culling.h"
#include "Math.h"
#include "Object.h"
#include <array>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class OMNIUI_SCENE_CLASS_API Arc : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Arc);
public:
class ArcGesturePayload : public AbstractGesture::GesturePayload
{
public:
Float distanceToCenter = 0.0;
Float angle = 0.0;
Float movedDistanceToCenter = 0.0;
Float movedAngle = 0.0;
Vector3 moved = Vector3{ 0.0 };
bool culled = false;
};
OMNIUI_SCENE_API
virtual ~Arc();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const ArcGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const ArcGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief The radius of the circle
*/
OMNIUI_PROPERTY(Float, radius, READ, getRadius, WRITE, setRadius, NOTIFY, _setRadiusChangedFn);
/**
* @brief The start angle of the arc.
*
* Angle placement and directions are (0 to 90): Y to Z, Z to X, X to Y
*/
OMNIUI_PROPERTY(Float, begin, DEFAULT, -Float(M_PI), READ, getBegin, WRITE, setBegin, NOTIFY, _setBeginChangedFn);
/**
* @brief The end angle of the arc.
*
* Angle placement and directions are (0 to 90): Y to Z, Z to X, X to Y
*/
OMNIUI_PROPERTY(Float, end, DEFAULT, Float(M_PI), READ, getEnd, WRITE, setEnd, NOTIFY, _setEndChangedFn);
/**
* @brief The thickness of the line
*/
OMNIUI_PROPERTY(
float, thickness, DEFAULT, 1.0, READ, getThickness, WRITE, setThickness, PROTECTED, NOTIFY, _setThicknessChangedFn);
/**
* @brief The thickness of the line for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionThickness,
DEFAULT,
0.0,
READ,
getIntersectionThickness,
WRITE,
setIntersectionThickness,
PROTECTED,
NOTIFY,
_setIntersectionThicknessChangedFn);
/**
* @brief The color of the line
*/
OMNIUI_PROPERTY(
Color4, color, DEFAULT, Color4{ 1.0 }, READ, getColor, WRITE, setColor, PROTECTED, NOTIFY, _setColorChangedFn);
/**
* @brief Number of points on the curve
*/
OMNIUI_PROPERTY(uint16_t,
tesselation,
DEFAULT,
36,
READ,
getTesselation,
WRITE,
setTesselation,
PROTECTED,
NOTIFY,
_setTesselationChangedFn);
/**
* @brief When true, it's a line. When false it's a mesh.
*/
OMNIUI_PROPERTY(
bool, wireframe, DEFAULT, false, READ, isWireframe, WRITE, setWireframe, PROTECTED, NOTIFY, _setWireframeChangedFn);
/**
* @brief Draw two radii of the circle
*/
OMNIUI_PROPERTY(bool, sector, DEFAULT, true, READ, isSector, WRITE, setSector, PROTECTED, NOTIFY, _setSectorChangedFn);
/**
* @brief The axis the circle plane is perpendicular to
*/
OMNIUI_PROPERTY(uint8_t, axis, DEFAULT, 2, READ, getAxis, WRITE, setAxis, NOTIFY, _setAxisChangedFn);
/**
* @brief Draw two radii of the circle
*/
OMNIUI_PROPERTY(
Culling, culling, DEFAULT, Culling::eNone, READ, getCulling, WRITE, setCulling, PROTECTED, NOTIFY, _setCullingChangedFn);
protected:
/**
* @brief Constructs Arc
*/
OMNIUI_SCENE_API
Arc(Float radius);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _dirtyCache();
void _rebuildCache();
// Cache to avoid computation every frame
std::vector<Vector3> m_cachedPoints;
std::vector<Color4> m_cachedColors;
std::vector<uint32_t> m_cachedVertexIndices;
std::vector<uint32_t> m_cachedVertexCounts;
std::vector<uint32_t> m_cachedFlags;
std::vector<float> m_cachedThicknesses;
bool m_cacheIsDirty = true;
std::unique_ptr<ArcGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<ArcGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
bool m_intersectionThicknessExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/SceneContainerScope.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include <memory>
#include <stack>
// Creates the scope with the given stack widget. So all the items in the scope will be automatically placed to the
// given stack.
// TODO: Probably it's not the best name.
#define OMNIUI_SCENE_WITH_CONTAINER(A) \
for (OMNIUI_SCENE_NS::SceneContainerScope<> __parent{ A }; __parent.isValid(); __parent.invalidate())
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class AbstractContainer;
class AbstractItem;
/**
* @brief Singleton object that holds the stack of containers. We use it to automatically add widgets to the top
* container when the widgets are created.
*/
class OMNIUI_SCENE_CLASS_API SceneContainerStack
{
public:
// Singleton pattern.
SceneContainerStack(const SceneContainerStack&) = delete;
SceneContainerStack& operator=(const SceneContainerStack&) = delete;
// No move constructor and no move-assignments are allowed because of 12.8 [class.copy]/9 and 12.8 [class.copy]/20
// of the C++ standard
/**
* @brief The only instance of the singleton.
*/
OMNIUI_SCENE_API
static SceneContainerStack& instance();
/**
* @brief Push the container to the top of the stack. All the newly created widgets will be added to this container.
*/
OMNIUI_SCENE_API
void push(std::shared_ptr<AbstractContainer> current);
/**
* @brief Removes the container from the stack. The previous one will be active.
*/
OMNIUI_SCENE_API
void pop();
/**
* @brief Add the given widget to the top container.
*/
OMNIUI_SCENE_API
bool addChildToTop(std::shared_ptr<AbstractItem> child);
OMNIUI_SCENE_API
static std::shared_ptr<AbstractContainer> top();
private:
// Disallow instantiation outside of the class.
SceneContainerStack() = default;
std::stack<std::shared_ptr<AbstractContainer>> m_stack;
};
/**
* @brief Puts the given container to the top of the stack when this object is constructed. And removes this container
* when it's destructed.
*/
class OMNIUI_SCENE_CLASS_API SceneContainerScopeBase
{
public:
OMNIUI_SCENE_API
SceneContainerScopeBase(const std::shared_ptr<AbstractContainer> current);
OMNIUI_SCENE_API
virtual ~SceneContainerScopeBase();
/**
* @brief Returns the container it was created with.
*/
const std::shared_ptr<AbstractContainer>& get() const
{
return m_current;
}
/**
* @brief Checks if this object is valid. It's always valid untill it's invalidated. Once it's invalidated, there is
* no way to make it valid again.
*/
bool isValid() const
{
return m_isValid;
}
/**
* @brief Makes this object invalid.
*/
void invalidate()
{
m_isValid = false;
}
private:
std::shared_ptr<AbstractContainer> m_current;
bool m_isValid;
};
/**
* @brief The templated class SceneContainerScope creates a new container and puts it to the top of the stack.
*/
template <class T = void>
class SceneContainerScope : public SceneContainerScopeBase
{
public:
template <typename... Args>
SceneContainerScope(Args&&... args) : SceneContainerScopeBase{ T::create(std::forward<Args>(args)...) }
{
}
};
/**
* @brief Specialization. It takes existing container and puts it to the top of the stack.
*/
template <>
class SceneContainerScope<void> : public SceneContainerScopeBase
{
public:
template <typename... Args>
SceneContainerScope(const std::shared_ptr<AbstractContainer> current)
: SceneContainerScopeBase{ std::move(current) }
{
}
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/PolygonMesh.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief Encodes a mesh.
*/
class OMNIUI_SCENE_CLASS_API PolygonMesh : public AbstractShape
{
OMNIUI_SCENE_OBJECT(PolygonMesh);
public:
class PolygonMeshGesturePayload : public AbstractGesture::GesturePayload
{
public:
// The id of the face intersected.
int32_t faceId = -1;
// The coords of the intersection in the space of the face.
Float s = 0.0;
Float t = 0.0;
};
OMNIUI_SCENE_API
virtual ~PolygonMesh();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const PolygonMeshGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const PolygonMeshGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief The primary geometry attribute, describes points in local space.
*/
OMNIUI_PROPERTY(std::vector<Vector3>, positions, READ, getPositions, WRITE, setPositions, NOTIFY, _setPositionsChangedFn);
/**
* @brief Describes colors per vertex.
*/
OMNIUI_PROPERTY(std::vector<Color4>, colors, READ, getColors, WRITE, setColors, NOTIFY, _setColorsChangedFn);
/**
* @brief Provides the number of vertices in each face of the mesh, which is
* also the number of consecutive indices in vertex_indices that define the
* face. The length of this attribute is the number of faces in the mesh.
*/
OMNIUI_PROPERTY(std::vector<uint32_t>,
vertexCounts,
READ,
getVertexCounts,
WRITE,
setVertexCounts,
NOTIFY,
_setVertexCountsChangedFn);
/**
* @brief Flat list of the index (into the points attribute) of each vertex
* of each face in the mesh.
*/
OMNIUI_PROPERTY(std::vector<uint32_t>,
vertexIndices,
READ,
getVertexIndices,
WRITE,
setVertexIndices,
NOTIFY,
_setVertexIndicesChangedFn);
/**
* @brief When wireframe is true, it defines the thicknesses of lines.
*/
OMNIUI_PROPERTY(
std::vector<float>, thicknesses, READ, getThicknesses, WRITE, setThicknesses, NOTIFY, _setThicknessesChangedFn);
/**
* @brief The thickness of the line for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionThickness,
DEFAULT,
0.0,
READ,
getIntersectionThickness,
WRITE,
setIntersectionThickness,
PROTECTED,
NOTIFY,
_setIntersectionThicknessChangedFn);
/**
* @brief When true, the mesh is drawn as lines.
*/
OMNIUI_PROPERTY(bool, wireframe, DEFAULT, false, READ, isWireframe, WRITE, setWireframe, NOTIFY, _setWireframeChangedFn);
protected:
/**
* @brief Construct a mesh with predefined properties.
*
* @param positions Describes points in local space.
* @param colors Describes colors per vertex.
* @param vertexCounts The number of vertices in each face.
* @param vertexIndices The list of the index of each vertex of each face in
* the mesh.
*/
OMNIUI_SCENE_API
PolygonMesh(const std::vector<Vector3>& positions,
const std::vector<Color4>& colors,
const std::vector<uint32_t>& vertexCounts,
const std::vector<uint32_t>& vertexIndices);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _dirtyCache();
void _rebuildCache();
void _calculateST(const Vector3 origin, const Vector3 direction, Float& g_s, Float& g_t, int32_t& g_faceId,
Vector3& g_itemClosestPoint, Vector3& g_rayClosestPoint, Float& g_rayDistance);
std::unique_ptr<PolygonMeshGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<PolygonMeshGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
// Cache to avoid computation every frame
std::vector<Color4> m_cachedColors;
std::vector<uint32_t> m_cachedVertexIndices;
std::vector<uint32_t> m_cachedVertexCounts;
std::vector<float> m_cachedThicknesses;
std::vector<Vector2> m_cachedUvs;
std::vector<void*> m_cachedTextures;
bool m_cacheIsDirty = true;
bool m_intersectionThicknessExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/DrawBufferIndex.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "DrawBuffer.h"
#include <array>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief A simple array with BufferType::eCount elements. Every transform can
* match to several types of bufferrs (Line and Point for example). We use this
* object to track the index of each type.
*/
class DrawBufferIndex
{
public:
DrawBufferIndex()
{
this->clear();
}
size_t& operator[](size_t i)
{
return m_index[i];
}
const size_t& operator[](size_t i) const
{
return m_index[i];
}
constexpr size_t size() const
{
return static_cast<size_t>(DrawBuffer::BufferType::eCount);
}
void clear()
{
// Default is SIZE_MAX which means "no buffer"
std::fill(m_index.begin(), m_index.end(), SIZE_MAX);
}
bool empty() const
{
for (size_t i = 0, n = this->size(); i < n; ++i)
{
if ((*this)[i] != SIZE_MAX)
{
return false;
}
}
return true;
}
private:
typedef std::array<size_t, static_cast<size_t>(DrawBuffer::BufferType::eCount)> _BufferIndexArray;
_BufferIndexArray m_index;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Line.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class OMNIUI_SCENE_CLASS_API Line : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Line);
public:
class LineGesturePayload : public AbstractGesture::GesturePayload
{
public:
Float lineDistance = 0.0;
Vector3 lineClosestPoint = Vector3{ 0.0 };
Float movedDistance = 0.0;
Vector3 moved = Vector3{ 0.0 };
};
OMNIUI_SCENE_API
virtual ~Line();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const LineGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const LineGesturePayload* getGesturePayload(GestureState state) const override;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
Float getIntersectionDistance() const override;
/**
* @brief The start point of the line
*/
OMNIUI_PROPERTY(Vector3, start, DEFAULT, Vector3{ 0.0 }, READ, getStart, WRITE, setStart);
/**
* @brief The end point of the line
*/
OMNIUI_PROPERTY(Vector3, end, DEFAULT, Vector3{ 0.0 }, READ, getEnd, WRITE, setEnd);
/**
* @brief The line color
*/
OMNIUI_PROPERTY(Color4, color, DEFAULT, Color4{ 1.0 }, READ, getColor, WRITE, setColor);
/**
* @brief The line thickness
*/
OMNIUI_PROPERTY(float, thickness, DEFAULT, 1.0, READ, getThickness, WRITE, setThickness);
/**
* @brief The thickness of the line for the intersection
*/
OMNIUI_PROPERTY(float,
intersectionThickness,
DEFAULT,
0.0,
READ,
getIntersectionThickness,
WRITE,
setIntersectionThickness,
PROTECTED,
NOTIFY,
_setIntersectionThicknessChangedFn);
protected:
OMNIUI_SCENE_API
Line();
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief A simple line
*
* @param start The start point of the line
* @param end The end point of the line
*/
OMNIUI_SCENE_API
Line(const Vector3& start, const Vector3& end);
std::unique_ptr<LineGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<LineGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
bool m_intersectionThicknessExplicitlyChanged = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/HoverGesture.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Object.h"
#include "ShapeGesture.h"
#include <chrono>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The gesture that provides a way to capture event when mouse
* enters/leaves the item.
*/
class OMNIUI_SCENE_CLASS_API HoverGesture : public ShapeGesture
{
OMNIUI_GESTURE_OBJECT(HoverGesture)
public:
OMNIUI_SCENE_API
~HoverGesture();
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Process the gesture and call callbacks if necessary.
*/
OMNIUI_SCENE_API
void process() override;
/**
* @brief Called if the callback is not set and the mouse enters the item
*/
OMNIUI_SCENE_API
virtual void onBegan();
/**
* @brief Called if the callback is not set and the mouse is hovering the item
*/
OMNIUI_SCENE_API
virtual void onChanged();
/**
* @brief Called if the callback is not set and the mouse leaves the item
*/
OMNIUI_SCENE_API
virtual void onEnded();
/**
* @brief The mouse button this gesture is watching.
*/
OMNIUI_PROPERTY(uint32_t, mouseButton, DEFAULT, 0, READ, getMouseButton, WRITE, setMouseButton);
/**
* @brief The modifier that should be pressed to trigger this gesture.
*/
OMNIUI_PROPERTY(uint32_t, modifiers, DEFAULT, UINT32_MAX, READ, getModifiers, WRITE, setModifiers);
/**
* @brief Determines whether the gesture is triggered only when the
* SceneView is hovered by the mouse and not covered by other window.
* By default it is false which means the gesture will trigger regardless of
* hover state.
*/
OMNIUI_PROPERTY(bool, triggerOnViewHover, DEFAULT, false, READ, getTriggerOnViewHover, WRITE, setTriggerOnViewHover);
/**
* @brief Called when the mouse enters the item
*/
OMNIUI_CALLBACK(OnBegan, void, AbstractShape const*);
/**
* @brief Called when the mouse is hovering the item
*/
OMNIUI_CALLBACK(OnChanged, void, AbstractShape const*);
/**
* @brief Called when the mouse leaves the item
*/
OMNIUI_CALLBACK(OnEnded, void, AbstractShape const*);
protected:
/**
* @brief Constructs an gesture to track when the user clicked the mouse.
*
* @param onEnded Function that is called when the user clicked the mouse
* button.
*/
OMNIUI_SCENE_API
HoverGesture(std::function<void(AbstractShape const*)> onEnded = nullptr);
Vector3 m_itemLastPoint = Vector3{ 0.0 };
Vector3 m_rayLastPoint = Vector3{ 0.0 };
// We need it because the gesture is triggered with a delay.
std::chrono::steady_clock::time_point m_startedAt;
// Flag that indicates the state when the gesture is about to ended.
bool m_readyForEnd = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ScrollGesture.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Object.h"
#include "ShapeGesture.h"
#include <chrono>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The gesture that provides a way to capture mouse scroll event.
*/
class OMNIUI_SCENE_CLASS_API ScrollGesture : public ShapeGesture
{
OMNIUI_GESTURE_OBJECT(ScrollGesture)
public:
OMNIUI_SCENE_API
~ScrollGesture();
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Process the gesture and call callbacks if necessary.
*/
OMNIUI_SCENE_API
void process() override;
/**
* @brief Called if the callback is not set when the user scrolls.
*/
OMNIUI_SCENE_API
virtual void onEnded();
/**
* @brief Returns the current scroll state.
*/
OMNIUI_SCENE_API
Vector2 getScroll() const;
/**
* @brief The mouse button this gesture is watching.
*/
OMNIUI_PROPERTY(uint32_t, mouseButton, DEFAULT, 0, READ, getMouseButton, WRITE, setMouseButton);
/**
* @brief The modifier that should be pressed to trigger this gesture.
*/
OMNIUI_PROPERTY(uint32_t, modifiers, DEFAULT, UINT32_MAX, READ, getModifiers, WRITE, setModifiers);
/**
* @brief Called when the user scrolls.
*/
OMNIUI_CALLBACK(OnEnded, void, AbstractShape const*);
protected:
/**
* @brief Constructs an gesture to track when the user clicked the mouse.
*
* @param onEnded Function that is called when the user clicked the mouse
* button.
*/
OMNIUI_SCENE_API
ScrollGesture(std::function<void(AbstractShape const*)> onEnded = nullptr);
Vector2 m_mouseWheel = Vector2{ (Float)0.0 };
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Callback.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include <boost/preprocessor.hpp>
#include <functional>
#include <vector>
// Receives: 3, 1, (int, char, float)
// Generates: char arg1
#define OMNIUI_ARGUMENT_NAME(z, n, seq) BOOST_PP_TUPLE_ELEM(n, seq) arg##n
// Receives: int, char, float
// Generates: (int arg0, char arg1, float arg2)
#define OMNIUI_FUNCTION_ARGS(...) \
BOOST_PP_IF( \
BOOST_PP_IS_EMPTY(__VA_ARGS__), (), \
(BOOST_PP_ENUM(BOOST_PP_TUPLE_SIZE(BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)), OMNIUI_ARGUMENT_NAME, \
BOOST_PP_IF(BOOST_PP_IS_EMPTY(__VA_ARGS__), (error), BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)))))
// Receives: int, char, float
// Generates: (arg0, arg1, arg2)
#define OMNIUI_CALL_ARGS(...) \
BOOST_PP_IF(BOOST_PP_IS_EMPTY(__VA_ARGS__), (), (BOOST_PP_ENUM_PARAMS(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), arg)))
#define OMNIUI_VA_TEMPLATE(type, ...) type BOOST_PP_COMMA_IF(BOOST_PP_NOT(BOOST_PP_IS_EMPTY(__VA_ARGS__))) __VA_ARGS__
template <typename T>
inline T __return_type_init()
{
return static_cast<T>(NULL);
}
template <>
inline std::string __return_type_init<std::string>()
{
return std::string("");
}
/**
* @brief This is the macro to define a widget callback. It creates the callback holder and four methods: set, on
* changed, has and call.
*
* Using: OMNIUI_CALLBACK(MouseReleased, void, float, float, int32_t, carb::input::KeyboardModifierFlags);
*
* Expands to:
* private:
* Callback<void, float, float, int32_t, carb::input::KeyboardModifierFlags> m_MouseReleasedCallback{ this };
* public:
* virtual void setMouseReleasedFn(
* std::function<void(float, float, int32_t, carb::input::KeyboardModifierFlags)> fn)
* {
* m_MouseReleasedCallback.set(std::move(fn));
* }
* virtual void setMouseReleasedChangedFn(std::function<void()> fn)
* {
* m_MouseReleasedCallback.setOnChanged(std::move(fn));
* }
* void callMouseReleasedFn(float arg0, float arg1, int32_t arg2, carb::input::KeyboardModifierFlags arg3)
* {
* if (this->hasMouseReleasedFn())
* {
* m_MouseReleasedCallback(arg0, arg1, arg2, arg3);
* }
* return static_cast<void>(0);
* }
* bool hasMouseReleasedFn() const
* {
* return m_MouseReleasedCallback;
* }
*/
#define OMNIUI_CALLBACK(name, type, ...) \
private: \
Callback<CallbackHelperBase, OMNIUI_VA_TEMPLATE(type, __VA_ARGS__)> m_##name##Callback{ this }; \
\
public: \
virtual void set##name##Fn(std::function<type(__VA_ARGS__)> fn) \
{ \
m_##name##Callback.set(std::move(fn)); \
} \
\
virtual void set##name##ChangedFn(std::function<void()> fn) \
{ \
m_##name##Callback.setOnChanged(std::move(fn)); \
} \
type call##name##Fn OMNIUI_FUNCTION_ARGS(__VA_ARGS__) \
{ \
if (this->has##name##Fn()) \
{ \
return m_##name##Callback OMNIUI_CALL_ARGS(__VA_ARGS__); \
} \
\
return __return_type_init<type>(); \
} \
\
bool has##name##Fn() const \
{ \
return m_##name##Callback; \
}
OMNIUI_NAMESPACE_OPEN_SCOPE
template <typename W>
class CallbackBase;
/**
* @brief Base class for the objects that should automatically clean up the callbacks. It collects all the callbacks
* created with OMNIUI_CALLBACK and is able to clean all of them. We use it to destroy the callbacks if the parent
* object is destroyed, and it helps to break circular references created by pybind11 because pybind11 can't use weak
* pointers.
*/
template <typename W>
class OMNIUI_CLASS_API CallbackHelper
{
public:
using CallbackHelperBase = W;
void initializeCallback(CallbackBase<W>* callback)
{
m_callbacks.push_back(callback);
}
void disposeCallback(CallbackBase<W>* callback)
{
auto found = std::find(m_callbacks.begin(), m_callbacks.end(), callback);
if (found != m_callbacks.end())
{
m_callbacks.erase(found);
}
}
void destroyCallbacks()
{
if (!m_callbacksValid)
{
return;
}
m_callbacksValid = false;
for (auto& callback : m_callbacks)
{
callback->destroy();
}
}
private:
std::vector<CallbackBase<W>*> m_callbacks;
bool m_callbacksValid = true;
};
/**
* @brief Base object for callback containers.
*/
template <typename W>
class OMNIUI_CLASS_API CallbackBase
{
public:
CallbackBase(CallbackHelper<W>* widget) : m_parent{ widget }
{
if (m_parent)
{
m_parent->initializeCallback(this);
}
}
virtual ~CallbackBase()
{
if (m_parent)
{
m_parent->disposeCallback(this);
}
}
virtual operator bool() const = 0;
virtual void destroy() = 0;
private:
CallbackHelper<W>* m_parent;
};
/**
* @brief Callback containers that is used with OMNIUI_CALLBACK macro. It keeps only one function, but it's possible to
* set up another function called when the main one is replaced.
*/
template <typename W, typename T, typename... Args>
class Callback : public CallbackBase<W>
{
public:
using CallbackType = std::function<T(Args...)>;
Callback(CallbackHelper<W>* widget) : CallbackBase<W>{ widget }
{
}
void set(std::function<T(Args...)> fn)
{
m_callback = std::move(fn);
if (m_onChanged)
{
m_onChanged();
}
}
void setOnChanged(std::function<void()> fn)
{
m_onChanged = std::move(fn);
}
T operator()(Args... args)
{
return m_callback(args...);
}
operator bool() const override
{
return static_cast<bool>(m_callback);
}
void destroy() override
{
m_callback = {};
m_onChanged = {};
}
private:
CallbackType m_callback;
std::function<void()> m_onChanged;
};
/**
* @brief Callback containers that is used with OMNIUI_PROPERTY macro.
*/
template <typename W, typename... Args>
class PropertyCallback : public CallbackBase<W>
{
public:
PropertyCallback(CallbackHelper<W>* widget) : CallbackBase<W>{ widget }
{
}
void add(std::function<void(Args...)> fn)
{
m_callbacks.emplace_back(std::move(fn));
}
void operator()(Args... args)
{
for (auto const& f : m_callbacks)
{
f(args...);
}
}
operator bool() const override
{
return !m_callbacks.empty();
}
void destroy() override
{
m_callbacks.clear();
}
private:
std::vector<std::function<void(Args...)>> m_callbacks;
};
OMNIUI_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Transform.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractContainer.h"
#include "DrawBufferIndex.h"
#include "Math.h"
#include "Object.h"
#include "Space.h"
#include "TransformBasis.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief Transforms children with component affine transformations
*/
class OMNIUI_SCENE_CLASS_API Transform : public AbstractContainer
{
OMNIUI_SCENE_OBJECT(Transform);
public:
enum class LookAt
{
eNone = 0,
eCamera,
};
OMNIUI_SCENE_API
virtual ~Transform();
OMNIUI_SCENE_API
virtual void destroy();
Matrix44 getAccumulatedTransform() const override;
/**
* @brief Single transformation matrix
*/
OMNIUI_PROPERTY(Matrix44,
transform,
DEFAULT,
Matrix44{ (Float)1.0 },
READ,
getTransform,
WRITE,
setTransform,
PROTECTED,
NOTIFY,
_setTransformChangedFn);
/**
* @brief Which space the current transform will be rescaled before applying
* the matrix. It's useful to make the object the same size regardless the
* distance to the camera.
*/
OMNIUI_PROPERTY(Space, scaleTo, DEFAULT, Space::eCurrent, READ, getScaleTo, WRITE, setScaleTo);
/**
* @brief Rotates this transform to align the direction with the camera.
*/
OMNIUI_PROPERTY(LookAt, lookAt, DEFAULT, LookAt::eNone, READ, getLookAt, WRITE, setLookAt);
/**
* @brief Set a basis to this transform. A basis defines a different/new transform space for thisTransform,
* separate from any inherited hierarchy or existing, assumed space. As such, Transform objects with a non-null
* basis will adhere to their basis and ignore any existing transform stack in their tree.
*
* @param basis The basis to set. Setting this to nullptr or an empty shared_ptr is valid.
*/
OMNIUI_SCENE_API
void setBasis(std::shared_ptr<TransformBasis> basis);
/**
* @brief Get the basis pointer for this Transform.
*
* @return std::shared_ptr<TransformBasis> This may be an empty shared_ptr.
*/
OMNIUI_SCENE_API
std::shared_ptr<TransformBasis> getBasis() const;
protected:
/**
* @brief Constructor
*/
OMNIUI_SCENE_API
Transform();
OMNIUI_SCENE_API
void _preDrawContent(
const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height) override;
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
OMNIUI_SCENE_API
Transform(const Matrix44& transform);
private:
Matrix44 m_cachedTransform = Matrix44{ (Float)1.0 };
DrawBufferIndex m_bufferIndex;
std::shared_ptr<TransformBasis> m_basis;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ImageHelper.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "Math.h"
#include <omni/ui/Property.h>
OMNIUI_NAMESPACE_OPEN_SCOPE
class ImageProvider;
OMNIUI_NAMESPACE_CLOSE_SCOPE
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class SceneView;
/**
* @brief The helper class for the widgets that are working with image, e.g. sc.Image and sc.TexturedMesh.
*/
class OMNIUI_SCENE_CLASS_API ImageHelper
{
public:
virtual std::shared_ptr<ImageProvider> const& getImageProvider() const = 0;
virtual void setImageProvider(std::shared_ptr<ImageProvider> const& v) = 0;
virtual std::string const& getSourceUrl() const = 0;
virtual void setSourceUrl(const std::string& url) = 0;
/**
* @brief The resolution for rasterization of svg and for ImageProvider.
*/
OMNIUI_PROPERTY(uint32_t, imageWidth, DEFAULT, 0, READ, getImageWidth, WRITE, setImageWidth);
/**
* @brief The resolution of rasterization of svg and for ImageProvider.
*/
OMNIUI_PROPERTY(uint32_t, imageHeight, DEFAULT, 0, READ, getImageHeight, WRITE, setImageHeight);
protected:
ImageHelper();
virtual ~ImageHelper();
void _prepareDrawContent(
const Matrix44& projection, const Matrix44& view, bool& cacheIsDirty, void** texture, void** resource);
void _sourceUrlChanged();
void _providerChanged();
float _computeImageWidth(float width) const;
float _computeImageHeight(float height) const;
// Image resolution cache
float m_textureWidthCache = 0.0f;
float m_textureHeightCache = 0.0f;
private:
const uint32_t m_textureUsageFlags;
bool m_sourceUrlChangedInternallyFlag = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Scene.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractContainer.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class DrawBuffer;
struct DrawData;
class DrawList;
class AbstractGesture;
/**
* @brief Represents the root of the scene and holds the shapes, gestures and
* managers.
*/
class OMNIUI_SCENE_CLASS_API Scene : public AbstractContainer
{
OMNIUI_SCENE_OBJECT(Scene);
public:
OMNIUI_SCENE_API
virtual ~Scene();
OMNIUI_SCENE_API
void destroy() override;
/**
* @brief Returns gesture manager used by default.
*/
OMNIUI_SCENE_API
const std::shared_ptr<GestureManager>& getDefaultGestureManager() const;
/**
* @brief Return the number of buffers used. Using for unit testing.
*/
OMNIUI_SCENE_API
size_t getDrawListBufferCount() const;
protected:
friend class AbstractItem;
friend class SceneView;
OMNIUI_SCENE_API
Scene();
void _preDrawContent(
const MouseInput&, const Matrix44& projection, const Matrix44& view, float width, float height) override;
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _postDrawContent(const Matrix44& projection, const Matrix44& view) override;
const Scene* _getScene() const override
{
return this;
}
const DrawData& _getDrawData() const;
DrawList* _getDrawList() const;
std::unique_ptr<DrawList> m_drawList;
std::shared_ptr<GestureManager> m_defaultGestureManager;
std::vector<std::shared_ptr<GestureManager>> m_gestureManagers;
// All the managers of the children
std::unordered_set<GestureManager*> m_cachedManagers;
std::unordered_set<AbstractGesture*> m_cachedGestures;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/GestureManager.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractGesture.h"
#include "Api.h"
#include "Math.h"
#include <omni/ui/Property.h>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class AbstractGesture;
struct MouseInput;
/**
* @brief The object that controls batch processing and preventing of gestures.
* Typically each scene has a default manager and if the user wants to have own
* prevention logic, he can reimplement it.
*/
class OMNIUI_SCENE_CLASS_API GestureManager
{
public:
/**
* @brief Constructor
*/
OMNIUI_SCENE_API
GestureManager();
OMNIUI_SCENE_API
virtual ~GestureManager();
/**
* @brief Set the camera
*
* @todo resolution
*/
void setView(const Matrix44& projection, const Matrix44& view, const Vector2& frameSize);
/**
* @brief Process mouse inputs and do all the intersections.
*/
void preProcess(const MouseInput& input);
/**
* @brief Process all the prevention logic and reduce the number of
* gestures.
*/
void prevent(const std::unordered_set<AbstractGesture*>& cachedGestures);
/**
* @brief Process the gestures.
*/
void process();
/**
* @brief Clean-up caches, save states.
*/
void postProcess();
/**
* @brief Called per gesture. Determines if the gesture can be prevented.
*/
OMNIUI_SCENE_API
virtual bool canBePrevented(AbstractGesture* gesture) const;
/**
* @brief Called per gesture. Determines if the gesture should be prevented
* with another gesture. Useful to resolve intersections.
*/
OMNIUI_SCENE_API
virtual bool shouldPrevent(AbstractGesture* gesture, const AbstractGesture* gesturePreventer) const;
/**
* @brief Called once a frame. Should be overriden to inject own input to the gestures.
*/
OMNIUI_SCENE_API
virtual MouseInput amendInput(MouseInput input) const;
OMNIUI_SCENE_API
void setMaxWait(uint32_t);
OMNIUI_SCENE_API
void setMaxWait(uint32_t, bool force);
OMNIUI_SCENE_API
uint32_t getMaxWait() const;
private:
friend class AbstractItem;
friend class AbstractGesture;
friend class Scene;
struct PreventCache
{
// The latest state shouldPrevent is called for
GestureState canBePreventedState = GestureState::eNone;
};
// A data structure that stores the latest prevention-related state for each
// gesture currently being managed. By preserving this state information
// across frames, the prevention logic can optimize its processing, avoiding
// unnecessary checks for gestures whose state hasn't changed.
std::unordered_map<AbstractGesture*, GestureState> m_preventionStateCache;
void _trackGesture(AbstractGesture* gesture);
void _loseGesture(AbstractGesture* gesture);
void _collectGestures(std::unordered_set<AbstractGesture*>& gesture) const;
std::unordered_map<AbstractGesture*, PreventCache> m_cachedGestures;
Matrix44 m_projection = Matrix44{ (Float)1.0 };
Matrix44 m_view = Matrix44{ (Float)1.0 };
Vector2 m_frameSize = Vector2{ (Float)0.0 };
uint32_t m_maxWait = 0;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/AbstractContainer.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractItem.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief Base class for all the items that have children
*/
class OMNIUI_SCENE_CLASS_API AbstractContainer : public AbstractItem
{
public:
OMNIUI_SCENE_API
~AbstractContainer() override;
OMNIUI_SCENE_API
void destroy() override;
/**
* @brief Transform the given point from the coordinate system fromspace to
* the coordinate system tospace.
*/
OMNIUI_SCENE_API
Vector3 transformSpace(Space fromSpace, Space toSpace, const Vector3& point) const override;
/**
* @brief Transform the given vector from the coordinate system fromspace to
* the coordinate system tospace.
*/
OMNIUI_SCENE_API
Vector4 transformSpace(Space fromSpace, Space toSpace, const Vector4& vector) const override;
/**
* @brief Adds item to this container in a manner specific to the container. If it's allowed to have one
* sub-widget only, it will be overwriten.
*/
OMNIUI_SCENE_API
virtual void addChild(std::shared_ptr<AbstractItem> item);
/**
* @brief Removes the container items from the container.
*/
OMNIUI_SCENE_API
virtual void clear();
OMNIUI_SCENE_API
virtual Matrix44 getAccumulatedTransform() const;
protected:
OMNIUI_SCENE_API
AbstractContainer();
void _preDrawContent(
const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height) override;
void _postDrawContent(const Matrix44& projection, const Matrix44& view) override;
OMNIUI_SCENE_API
void _collectManagers(std::unordered_set<GestureManager*>& managers) const override;
std::vector<std::shared_ptr<AbstractItem>> m_children;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Image.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "ImageHelper.h"
#include "Rectangle.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class OMNIUI_SCENE_CLASS_API Image : public Rectangle, public ImageHelper
{
OMNIUI_SCENE_OBJECT(Image);
public:
enum class FillPolicy : uint8_t
{
eStretch = 0,
ePreserveAspectFit,
ePreserveAspectCrop
};
OMNIUI_SCENE_API
virtual ~Image();
/**
* @brief This property holds the image URL. It can be an `omni:` path, a `file:` path, a direct path or the path
* relative to the application root directory.
*/
OMNIUI_PROPERTY(
std::string, sourceUrl, READ, getSourceUrl, WRITE, setSourceUrl, PROTECTED, NOTIFY, _setSourceUrlChangedFn);
/**
* @brief This property holds the image provider. It can be an `omni:` path, a `file:` path, a direct path or the
* path relative to the application root directory.
*/
OMNIUI_PROPERTY(std::shared_ptr<ImageProvider>,
imageProvider,
READ,
getImageProvider,
WRITE,
setImageProvider,
PROTECTED,
NOTIFY,
_setImageProviderChangedFn);
/**
* @brief Define what happens when the source image has a different size than the item.
*/
OMNIUI_PROPERTY(FillPolicy,
fillPolicy,
DEFAULT,
FillPolicy::ePreserveAspectFit,
READ,
getFillPolicy,
WRITE,
setFillPolicy,
PROTECTED,
NOTIFY,
_setFillPolicyChangedFn);
protected:
/**
* @brief Created an image with the given URL
*/
OMNIUI_SCENE_API
Image(const std::string& sourceUrl, Float width = 1.0, Float height = 1.0);
/**
* @brief Created an image with the given provider
*/
OMNIUI_SCENE_API
Image(const std::shared_ptr<ImageProvider>& imageProvider, Float width = 1.0, Float height = 1.0);
/**
* @brief Created an empty image
*/
OMNIUI_SCENE_API
Image(Float width = 1.0, Float height = 1.0);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
void _rebuildCache() override;
private:
void _initialize(Float width, Float height);
std::vector<Vector2> m_cachedUvs;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ClickGesture.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Object.h"
#include "ShapeGesture.h"
#include <chrono>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The gesture that provides a way to capture click mouse event.
*/
class OMNIUI_SCENE_CLASS_API ClickGesture : public ShapeGesture
{
OMNIUI_GESTURE_OBJECT(ClickGesture)
public:
OMNIUI_SCENE_API
~ClickGesture();
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Process the gesture and call callbacks if necessary.
*/
OMNIUI_SCENE_API
void process() override;
/**
* @brief Called if the callback is not set when the user releases the mouse
* button.
*/
OMNIUI_SCENE_API
virtual void onEnded();
/**
* @brief Set the internal state of the gesture. It's the way to cancel,
* prevent, or restore the gesture.
*/
OMNIUI_SCENE_API
virtual void setState(GestureState state);
/**
* @brief The mouse button this gesture is watching.
*/
OMNIUI_PROPERTY(uint32_t, mouseButton, DEFAULT, 0, READ, getMouseButton, WRITE, setMouseButton);
/**
* @brief The modifier that should be pressed to trigger this gesture.
*/
OMNIUI_PROPERTY(uint32_t, modifiers, DEFAULT, UINT32_MAX, READ, getModifiers, WRITE, setModifiers);
/**
* @brief Called when the user releases the button.
*/
OMNIUI_CALLBACK(OnEnded, void, AbstractShape const*);
protected:
// We need this delay to be able to finish double click if it exists
static constexpr int64_t kGestureWaitForEnd = 100;
/**
* @brief Constructs an gesture to track when the user clicked the mouse.
*
* @param onEnded Function that is called when the user clicked the mouse
* button.
*/
OMNIUI_SCENE_API
ClickGesture(std::function<void(AbstractShape const*)> onEnded = nullptr);
/**
* @brief The core implementation of preProcess to specify the number of clicks to use.
*
* @param nClicks The number of clicks (single / double) this gesture represents.
*/
OMNIUI_SCENE_API
void clickPreProcess(const Matrix44& projection, const Matrix44& view, uint32_t nClicks);
Vector3 m_itemLastPoint = Vector3{ 0.0 };
Vector3 m_rayLastPoint = Vector3{ 0.0 };
// We need it because the gesture is triggered with a delay.
std::chrono::steady_clock::time_point m_startedAt;
// Flag that indicates the state when the gesture is about to ended.
bool m_readyForEnd = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/AbstractGesture.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractItem.h"
#include "Api.h"
#include "Math.h"
#include <memory>
#include <unordered_set>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class GestureManager;
/**
* @brief The state of all the gestures. Basically it's begin-change-end, but
* each gesture gesides its workflow.
*/
enum class GestureState : uint32_t
{
eNone = 0,
ePossible,
eBegan,
eChanged,
eEnded,
eCanceled,
ePrevented,
eCount
};
/**
* @brief The base class for the gestures to provides a way to capture mouse
* events in 3d scene.
*/
class OMNIUI_SCENE_CLASS_API AbstractGesture : protected CallbackHelper<AbstractGesture>
{
public:
class GesturePayload
{
public:
Vector3 itemClosestPoint;
Vector3 rayClosestPoint;
Float rayDistance;
};
OMNIUI_SCENE_API
virtual ~AbstractGesture();
/**
* @brief Set the Manager that controld this gesture
*/
OMNIUI_SCENE_API
void setManager(const std::shared_ptr<GestureManager>& manager);
/**
* @brief The Manager that controld this gesture
*/
OMNIUI_SCENE_API
const std::shared_ptr<GestureManager>& getManager() const;
/**
* @brief Called by scene to process the mouse inputs and do intersections
* with shapes. It can be an entry point to simulate the mouse input.
*
* @todo We probably don't need projection-view here. We can get it from
* manager.
*/
virtual void dispatchInput(const MouseInput& input,
const Matrix44& projection,
const Matrix44& view,
const Vector2& frameSize) = 0;
/**
* @brief Called before the processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
virtual void preProcess(const Matrix44& projection, const Matrix44& view);
/**
* @brief Process the gesture and call callbacks if necessary.
*/
OMNIUI_SCENE_API
virtual void process();
/**
* @brief Gestures are finished. Clean-up.
*/
OMNIUI_SCENE_API
virtual void postProcess();
/**
* @brief Get the internal state that was before the current state.
*/
OMNIUI_SCENE_API
GestureState getPreviousState() const;
/**
* @brief Get the internal state of the gesture.
*/
OMNIUI_SCENE_API
GestureState getState() const;
/**
* @brief Set the internal state of the gesture. It's the way to cancel,
* prevent, or restore the gesture.
*/
OMNIUI_SCENE_API
virtual void setState(GestureState state);
/**
* @brief Returns true if the gesture is just changed at the current frame.
* If the state is not changed, `process()` will not be executed.
*/
bool isStateChanged() const;
/**
* @brief Returns the relevant shape driving the gesture.
*/
OMNIUI_SCENE_API
virtual const AbstractItem* getSender() const = 0;
/**
* @brief Shortcut for sender.get_gesturePayload
*
* @return OMNIUI_SCENE_API const*
*/
OMNIUI_SCENE_API
virtual const GesturePayload* getGesturePayload() const = 0;
/**
* @brief Shortcut for sender.get_gesturePayload
*
* @return OMNIUI_SCENE_API const*
*/
OMNIUI_SCENE_API
virtual const GesturePayload* getGesturePayload(GestureState state) const = 0;
/**
* @brief The name of the object. It's used for debugging.
*/
OMNIUI_PROPERTY(std::string, name, READ, getName, WRITE, setName);
protected:
friend class GestureManager;
OMNIUI_SCENE_API
AbstractGesture();
private:
void _setCanBePrevented(bool canBe);
bool _getCanBePrevented() const;
std::shared_ptr<GestureManager> m_manager = nullptr;
GestureState m_previousState = GestureState::eNone;
GestureState m_state = GestureState::eNone;
bool m_stateChanged = false;
bool m_cachedCanBePrevented = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/DrawBuffer.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "Math.h"
#include "TransformBasis.h"
#include <omni/ui/Property.h>
#include <memory>
#include <vector>
OMNIUI_NAMESPACE_USING_DIRECTIVE
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The InvisibleButton widget provides a transparent command button.
*/
class OMNIUI_SCENE_CLASS_API DrawBuffer
{
public:
typedef uint32_t DirtyBits;
static constexpr DirtyBits kDirtyBitTransform = (1 << 0);
struct Buffer
{
virtual ~Buffer();
std::vector<Vector4> m_positions;
std::vector<Color4> m_colors;
// Hashing
size_t m_positionsHash = 0;
size_t m_colorsHash = 0;
// Dirty Bits
static constexpr DirtyBits kDirtyBitPositions = (1 << 1);
static constexpr DirtyBits kDirtyBitColors = (1 << 2);
static constexpr DirtyBits kDirtyBitAll = UINT32_MAX;
};
struct Points : public Buffer
{
~Points() override;
std::vector<float> m_sizes;
// Hashing
size_t m_sizesHash = 0;
// Dirty Bits
static constexpr DirtyBits kDirtyBitSizes = (1 << 3);
static constexpr DirtyBits kDirtyBitAll =
kDirtyBitTransform | kDirtyBitPositions | kDirtyBitColors | kDirtyBitSizes;
};
struct Lines : public Buffer
{
~Lines() override;
std::vector<float> m_thicknesses;
std::vector<uint32_t> m_vertexCounts;
std::vector<uint32_t> m_vertexIndices;
std::vector<uint32_t> m_flags;
// Hashing
size_t m_thicknessesHash = 0;
size_t m_vertexCountsHash = 0;
size_t m_vertexIndicesHash = 0;
size_t m_flagsHash = 0;
// Dirty Bits
static constexpr DirtyBits kDirtyBitThicknesses = (1 << 3);
static constexpr DirtyBits kDirtyBitVertexCounts = (1 << 4);
static constexpr DirtyBits kDirtyBitVertexIndices = (1 << 5);
static constexpr DirtyBits kDirtyBitFlags = (1 << 6);
static constexpr DirtyBits kDirtyBitAll = kDirtyBitTransform | kDirtyBitPositions | kDirtyBitColors |
kDirtyBitThicknesses | kDirtyBitVertexCounts |
kDirtyBitVertexIndices | kDirtyBitFlags;
};
struct Polys : public Buffer
{
~Polys() override;
std::vector<uint32_t> m_vertexCounts;
std::vector<uint32_t> m_vertexIndices;
std::vector<Vector2> m_uvs;
std::vector<const void*> m_textures;
std::vector<const void*> m_resources;
// Hashing
size_t m_vertexCountsHash = 0;
size_t m_vertexIndicesHash = 0;
size_t m_uvsHash = 0;
size_t m_texturesHash = 0;
// Resources are linked to textures. It's impossible that resources
// changed and textures didn't change.
// Dirty Bits
static constexpr DirtyBits kDirtyBitVertexCounts = (1 << 3);
static constexpr DirtyBits kDirtyBitVertexIndices = (1 << 4);
static constexpr DirtyBits kDirtyBitUvs = (1 << 5);
static constexpr DirtyBits kDirtyBitTextures = (1 << 6);
static constexpr DirtyBits kDirtyBitAll = kDirtyBitTransform | kDirtyBitPositions | kDirtyBitColors |
kDirtyBitVertexCounts | kDirtyBitVertexIndices | kDirtyBitUvs |
kDirtyBitTextures;
};
struct Texts : public Buffer
{
~Texts() override;
std::vector<char> m_text;
std::vector<uint32_t> m_charactersCounts;
std::vector<float> m_sizes;
std::vector<uint32_t> m_flags;
// Hashing
size_t m_textHash = 0;
size_t m_charactersCountsHash = 0;
size_t m_sizesHash = 0;
size_t m_flagsHash = 0;
// Dirty Bits
static constexpr DirtyBits kDirtyBitText = (1 << 3);
static constexpr DirtyBits kDirtyBitCharactersCounts = (1 << 4);
static constexpr DirtyBits kDirtyBitSizes = (1 << 5);
static constexpr DirtyBits kDirtyBitFlags = (1 << 6);
static constexpr DirtyBits kDirtyBitAll = kDirtyBitTransform | kDirtyBitPositions | kDirtyBitColors |
kDirtyBitText | kDirtyBitCharactersCounts | kDirtyBitSizes |
kDirtyBitFlags;
};
enum class BufferType : size_t
{
eLines = 0,
ePoints,
ePolys,
eTexts,
eCount
};
OMNIUI_SCENE_API
DrawBuffer();
OMNIUI_SCENE_API
DrawBuffer(DrawBuffer&&);
OMNIUI_SCENE_API
~DrawBuffer();
OMNIUI_SCENE_API
void beginFrame();
OMNIUI_SCENE_API
void endFrame();
OMNIUI_SCENE_API
bool empty() const;
OMNIUI_SCENE_API
void addLine(const Vector3& begin, const Vector3& end, const Color4& color, float thickness);
OMNIUI_SCENE_API
void addText(const char* text, const Vector3& point, const Color4& color, float size, uint32_t flag);
OMNIUI_SCENE_API
void addPolygonLines(const Vector3* points,
const Color4* colors,
const float* thicknesses,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
const uint32_t* flags,
size_t vertexCountSize);
OMNIUI_SCENE_API
void addRect(Float width, Float height, const Color4& color, const void* texture);
OMNIUI_SCENE_API
void addPolygonMesh(const Vector4* points,
const Color4* colors,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
size_t vertexCountSize,
const Matrix44* transform = nullptr,
const Vector2* uvs = nullptr,
const void* const* textures = nullptr,
const void* const* resources = nullptr);
OMNIUI_SCENE_API
void addPolygonMesh(const Vector3* points,
const Color4* colors,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
size_t vertexCountSize,
const Matrix44* transform = nullptr,
const Vector2* uvs = nullptr,
const void* const* textures = nullptr,
const void* const* resources = nullptr);
OMNIUI_SCENE_API
void addPoints(const Vector4* positions,
const Color4* colors,
const float* sizes,
size_t pointCount,
const Matrix44* transform = nullptr);
OMNIUI_SCENE_API
void addPoints(const Vector4* positions,
const Color4& color,
float size,
size_t pointCount,
const Matrix44* transform = nullptr);
OMNIUI_SCENE_API
void addPoints(const Vector3* positions,
const Color4* colors,
const float* sizes,
size_t pointCount,
const Matrix44* transform = nullptr);
OMNIUI_SCENE_API
void addPoints(const Vector3* positions,
const Color4& color,
float size,
size_t pointCount,
const Matrix44* transform = nullptr);
OMNIUI_SCENE_API
bool getPointBuffer(const Points** points) const;
OMNIUI_SCENE_API
bool getLineBuffer(const Lines** lines) const;
OMNIUI_SCENE_API
bool getPolyBuffer(const Polys** polys) const;
OMNIUI_SCENE_API
bool getTextBuffer(const Texts** texts) const;
OMNIUI_SCENE_API
BufferType getBufferType() const;
OMNIUI_SCENE_API
void setBufferType(BufferType bufferType);
/**
* @brief Returns what changed since the last call.
*
* It knows what's changed with hashing all the arrays.
*
* @return OMNIUI_SCENE_API
*/
OMNIUI_SCENE_API
DirtyBits getDirtyBits() const;
OMNIUI_PROPERTY(Matrix44, transform, DEFAULT, Matrix44{ (Float)1.0 }, READ, getTransform, WRITE, setTransform);
OMNIUI_PROPERTY(std::shared_ptr<TransformBasis>, basis, DEFAULT, nullptr, READ_VALUE, getBasis, WRITE, setBasis);
private:
size_t calVertexIndexSize(const uint32_t* vertexCounts, size_t vertexCountSize);
size_t calPointSize(const uint32_t* vertexIndices, size_t vertexIndexSize);
template <typename PointsType>
void _addPolygonMesh(const PointsType* points,
const Vector4* colors,
const uint32_t* vertexIndices,
const uint32_t* vertexCounts,
size_t vertexCountSize,
const Matrix44* transform = nullptr,
const Vector2* uvs = nullptr,
const void* const* textures = nullptr,
const void* const* resources = nullptr);
mutable size_t m_transformHash = 0;
BufferType m_bufferType = BufferType::eCount;
std::unique_ptr<Buffer> m_buffer;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Culling.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include <string>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
enum class Culling
{
eNone = 0,
eBack,
eFront,
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ShapeGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractGesture.h"
#include "AbstractShape.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The base class for the gestures to provides a way to capture mouse
* events in 3d scene.
*/
class OMNIUI_SCENE_CLASS_API ShapeGesture : public AbstractGesture
{
public:
OMNIUI_SCENE_API
~ShapeGesture() override;
/**
* @brief Called by scene to process the mouse inputs and do intersections
* with shapes. It can be an entry point to simulate the mouse input.
*
* @todo We probably don't need projection-view here. We can get it from
* manager.
*/
OMNIUI_SCENE_API
void dispatchInput(const MouseInput& input,
const Matrix44& projection,
const Matrix44& view,
const Vector2& frameSize) override;
/**
* @brief Returns the relevant shape driving the gesture.
*/
OMNIUI_SCENE_API
const AbstractShape* getSender() const override;
OMNIUI_SCENE_API
const GesturePayload* getGesturePayload() const override;
OMNIUI_SCENE_API
const GesturePayload* getGesturePayload(GestureState state) const override;
OMNIUI_SCENE_API
virtual const MouseInput& getRawInput() const;
protected:
friend class AbstractShape;
OMNIUI_SCENE_API
ShapeGesture();
// Last mouse event.
MouseInput m_input;
// Last frame size
Vector2 m_frameSize;
private:
void _assignItem(AbstractShape* item);
void _dischargeItem(AbstractShape* item);
AbstractShape* m_currentShape = nullptr;
std::unordered_set<AbstractShape*> m_items;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Screen.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractShape.h"
#include "Math.h"
#include "Object.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The empty shape that triggers all the gestures at any place. Is used
* to track gestures when the user clicked the empty space. For example for
* cameras.
*/
class OMNIUI_SCENE_CLASS_API Screen : public AbstractShape
{
OMNIUI_SCENE_OBJECT(Screen);
public:
class ScreenGesturePayload : public AbstractGesture::GesturePayload
{
public:
Vector3 direction = Vector3{ 0.0 };
Vector3 moved = Vector3{ 0.0 };
// TODO: Maybe we need mouse in AbstractGesture::GesturePayload
Vector2 mouse = Vector2{ 0.0 };
Vector2 mouseMoved = Vector2{ 0.0 };
};
OMNIUI_SCENE_API
virtual ~Screen();
OMNIUI_SCENE_API
void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) override;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
const ScreenGesturePayload* getGesturePayload() const override;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
const ScreenGesturePayload* getGesturePayload(GestureState state) const override;
protected:
/**
* @brief Constructor
*/
OMNIUI_SCENE_API
Screen();
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
std::unique_ptr<ScreenGesturePayload> m_lastGesturePayload;
std::array<std::unique_ptr<ScreenGesturePayload>, static_cast<uint32_t>(GestureState::eCount)> m_itersections;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Widget.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Rectangle.h"
#include <memory>
OMNIUI_NAMESPACE_OPEN_SCOPE
class Frame;
OMNIUI_NAMESPACE_CLOSE_SCOPE
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class WindowPassThroughInputGesture;
/**
* @brief The shape that contains the omni.ui widgets. It automatically creates
* IAppWindow and transfers its content to the texture of the rectangle. It
* interacts with the mouse and sends the mouse events to the underlying window,
* so interacting with the UI on this rectangle is smooth for the user.
*/
class OMNIUI_SCENE_CLASS_API Widget : public Rectangle
{
OMNIUI_SCENE_OBJECT(Widget);
public:
enum class FillPolicy : uint8_t
{
eStretch = 0,
ePreserveAspectFit,
ePreserveAspectCrop
};
enum class UpdatePolicy : uint8_t
{
eOnDemand = 0,
eAlways,
eOnMouseHovered
};
OMNIUI_SCENE_API
virtual ~Widget();
/**
* @brief Return the main frame of the widget.
*/
OMNIUI_SCENE_API
const std::shared_ptr<omni::ui::Frame>& getFrame();
/**
* @brief Rebuild and recapture the widgets at the next frame. If `frame` has `build_fn`, it will also be called.
*/
OMNIUI_SCENE_API
void invalidate();
/**
* @brief Define what happens when the source image has a different size than the item.
*/
OMNIUI_PROPERTY(FillPolicy,
fillPolicy,
DEFAULT,
FillPolicy::ePreserveAspectFit,
READ,
getFillPolicy,
WRITE,
setFillPolicy,
PROTECTED,
NOTIFY,
_setFillPolicyChangedFn);
/**
* @brief Define when to redraw the widget.
*/
OMNIUI_PROPERTY(UpdatePolicy,
updatePolicy,
DEFAULT,
UpdatePolicy::eOnMouseHovered,
READ,
getUpdatePolicy,
WRITE,
setUpdatePolicy,
PROTECTED,
NOTIFY,
_setUpdatePolicyChangedFn);
/**
* @brief The resolution scale of the widget.
*/
OMNIUI_PROPERTY(float, resolutionScale, DEFAULT, 1.0f, READ, getResolutionScale, WRITE, setResolutionScale);
/**
* @brief The resolution of the widget framebuffer.
*/
OMNIUI_PROPERTY(uint32_t, resolutionWidth, DEFAULT, 0, READ, getResolutionWidth, WRITE, setResolutionWidth);
/**
* @brief The resolution of the widget framebuffer.
*/
OMNIUI_PROPERTY(uint32_t, resolutionHeight, DEFAULT, 0, READ, getResolutionHeight, WRITE, setResolutionHeight);
protected:
/**
* @brief Created an empty image
*/
OMNIUI_SCENE_API
Widget(Float width = 1.0, Float height = 1.0);
OMNIUI_SCENE_API
void _drawContent(const Matrix44& projection, const Matrix44& view) override;
// Recursively subdivide the poly
void _subdividePoly(size_t index, uint16_t levels);
void _rebuildCache() override;
void _validateImageProvider();
float _computeResolutionWidth() const;
float _computeResolutionHeight() const;
private:
std::vector<Vector2> m_cachedUvs;
// Widget resolution
uint32_t m_imageWidth = 0;
uint32_t m_imageHeight = 0;
// How many frames the mouse is outside the shape
uint32_t m_framesWhenMouseOutside = 0;
// How many frames since last invalidate
uint32_t m_framesCount = 0;
// Gesture and Image Provider shared_ptr to use it as a gesture
std::shared_ptr<WindowPassThroughInputGesture> m_inputGesture;
// Frozen widget is not updated. But AppWindow is valid.
bool m_frozen = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ImguiDrawSystem.h | // Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractDrawSystem.h"
#include <omni/ui/FontHelper.h>
#include <memory>
#include <vector>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class DrawBuffer;
/**
* @brief The InvisibleButton widget provides a transparent command button.
*/
class OMNIUI_SCENE_CLASS_API ImguiDrawSystem : public AbstractDrawSystem, public FontHelper
{
public:
ImguiDrawSystem();
~ImguiDrawSystem() override;
void setup() override;
void beginFrame() override;
void render(const DrawBuffer* const * buffers,
size_t bufferCount,
const Matrix44& projection,
const Matrix44& view,
float width,
float height,
float dpiScale) override;
void endFrame() override;
void destroy() override;
private:
void _drawLines(const DrawBuffer& buffer, const Matrix44& projectionView, float width, float height, float dpiScale) const;
void _cachePolys(const DrawBuffer& buffer, const Matrix44& projectionView, float width, float height) const;
void _cachePoints(const DrawBuffer& buffer, const Matrix44& projectionView, float width, float height) const;
void _drawPolys(const Matrix44& projectionView, float width, float height, float dpiScale);
void _drawPoints(const Matrix44& projectionView, float width, float height, float dpiScale);
void _drawTexts(const DrawBuffer& buffer, const Matrix44& projectionView, float width, float height, float dpiScale);
std::unique_ptr<DrawBuffer> m_flatPolyCache;
std::vector<Float> m_polyDepth;
std::vector<size_t> m_polySorted;
std::vector<size_t> m_indexStart;
std::unique_ptr<DrawBuffer> m_flatPointCache;
std::vector<size_t> m_pointSorted;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/ManipulatorGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractGesture.h"
#include "Manipulator.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The base class for the gestures to provides a way to capture events of
* the manipulator objects
*/
class OMNIUI_SCENE_CLASS_API ManipulatorGesture : public AbstractGesture
{
public:
OMNIUI_SCENE_API
~ManipulatorGesture() override;
/**
* @brief Called by scene to process the mouse inputs and do intersections
* with shapes. It can be an entry point to simulate the mouse input.
*
* @todo We probably don't need projection-view here. We can get it from
* manager.
*/
OMNIUI_SCENE_API
void dispatchInput(const MouseInput& input,
const Matrix44& projection,
const Matrix44& view,
const Vector2& frameSize) override;
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
/**
* @brief Returns the relevant shape driving the gesture.
*/
OMNIUI_SCENE_API
const Manipulator* getSender() const override;
OMNIUI_SCENE_API
const GesturePayload* getGesturePayload() const override;
OMNIUI_SCENE_API
const GesturePayload* getGesturePayload(GestureState state) const override;
protected:
friend class Manipulator;
friend class PyManipulator;
/**
* @brief Constructor
*/
OMNIUI_SCENE_API
ManipulatorGesture();
OMNIUI_SCENE_API
virtual void _processWithGesturePayload(const Manipulator* sender,
GestureState state,
std::shared_ptr<AbstractGesture::GesturePayload> gesturePayload);
// Last mouse event.
MouseInput m_input;
std::shared_ptr<AbstractGesture::GesturePayload> m_gesturePayload;
private:
void _assignItem(Manipulator* item);
void _dischargeItem(Manipulator* item);
const Manipulator* m_currentShape = nullptr;
std::unordered_set<const Manipulator*> m_items;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/Object.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include <omni/ui/scene/SceneContainerScope.h>
// The OMNIUI_OBJECT macro must appear in the public section of a class definition of all the objects that use
// other services provided by UI Framework system. It implements two public methods: create and castShared.
// We need to specify the class name because we need to have the text representation of it in getTypeName.
#define OMNIUI_SCENE_OBJECT(currentType) \
public: \
/* A little shortcut to get the current class type */ \
using This = currentType; \
\
/** Create the widget and put it as a child of the top item of ContainerStack. */ \
/* It's very useful to have the new object already attached to the layout. */ \
template <typename... Args> \
static std::shared_ptr<This> create(Args&&... args) \
{ \
/* Cannot use std::make_shared because the constructor is protected */ \
std::shared_ptr<This> ptr{ new This{ std::forward<Args>(args)... } }; \
\
SceneContainerStack::instance().addChildToTop(std::static_pointer_cast<AbstractItem>(ptr)); \
\
return ptr; \
} \
/* version that accepts a destructor and passes it to the shared_ptr */ \
template<class Destructor, typename... Args> \
static std::shared_ptr<This> createWithDestructor(Destructor destructor, Args&&... args) \
{ \
/* Cannot use std::make_shared because the constructor is protected */ \
std::shared_ptr<This> ptr{ new This{ std::forward<Args>(args)... }, std::forward<Destructor>(destructor) }; \
\
SceneContainerStack::instance().addChildToTop(std::static_pointer_cast<AbstractItem>(ptr)); \
\
return ptr; \
} \
\
/** Returns this as a shared pointer */ \
template <typename T = This> \
std::shared_ptr<T> castShared() \
{ \
return std::static_pointer_cast<T>(this->shared_from_this()); \
} \
\
/** Return the name of the current type. We use it to resolve the styles. */ \
virtual const std::string& getTypeName() const \
{ \
static const std::string typeName{ #currentType }; \
return typeName; \
} \
\
private:
#define OMNIUI_GESTURE_OBJECT(currentType) \
public: \
/* A little shortcut to get the current class type */ \
using This = currentType; \
\
/** Create the gesture */ \
template <typename... Args> \
static std::shared_ptr<This> create(Args&&... args) \
{ \
/* This is doesn't work because the constructor is protected: */ \
/* auto ptr = std::make_shared<This>(std::forward<Args>(args)...); */ \
/* TODO: Find the way to use make_shared */ \
std::shared_ptr<This> ptr{ new This{ std::forward<Args>(args)... } }; \
\
return ptr; \
} \
\
private:
|
omniverse-code/kit/include/omni/ui/scene/AbstractShape.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "AbstractGesture.h"
#include "AbstractItem.h"
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class ShapeGesture;
/**
* @brief Base class for all the items that can be drawn and intersected with
* mouse pointer.
*/
class OMNIUI_SCENE_CLASS_API AbstractShape : public AbstractItem
{
OMNIUI_SCENE_OBJECT(AbstractShape);
public:
OMNIUI_SCENE_API
~AbstractShape() override;
OMNIUI_SCENE_API
void destroy() override;
/**
* @brief All the gestures assigned to this shape
*/
OMNIUI_SCENE_API
const std::vector<std::shared_ptr<ShapeGesture>>& getGestures() const;
/**
* @brief Replace the gestures of the shape
*/
OMNIUI_SCENE_API
void setGestures(const std::vector<std::shared_ptr<ShapeGesture>>& gestures);
/**
* @brief Add a single gesture to the shape
*/
OMNIUI_SCENE_API
void addGesture(const std::shared_ptr<ShapeGesture>& gesture);
OMNIUI_SCENE_API
virtual void intersect(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state) = 0;
/**
* @brief Contains all the information about the intersection
*/
OMNIUI_SCENE_API
virtual const AbstractGesture::GesturePayload* getGesturePayload() const = 0;
/**
* @brief Contains all the information about the intersection at the specific state
*/
OMNIUI_SCENE_API
virtual const AbstractGesture::GesturePayload* getGesturePayload(GestureState state) const = 0;
/**
* @brief The distance in pixels from mouse pointer to the shape for the intersection.
*/
OMNIUI_SCENE_API
virtual Float getIntersectionDistance() const;
protected:
friend class ShapeGesture;
OMNIUI_SCENE_API
AbstractShape();
OMNIUI_SCENE_API
void _preDrawContent(
const MouseInput& input, const Matrix44& projection, const Matrix44& view, float width, float height) override;
void _collectManagers(std::unordered_set<GestureManager*>& managers) const override;
void _cacheGesturePayload(const Vector3 origin,
const Vector3 direction,
const Vector2 mouse,
const Matrix44& projection,
const Matrix44& view,
GestureState state);
std::vector<std::shared_ptr<ShapeGesture>> m_gestures;
bool m_gesturePayloadCached = false;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/AbstractManipulatorModel.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Api.h"
#include "Math.h"
#include <functional>
#include <map>
#include <memory>
#include <unordered_set>
#include <vector>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class ManipulatorModelHelper;
/**
* - Bridge to data.
* - Operates with double and int arrays.
* - No strings.
* - No tree, it's a flat list of items.
* - Manipulator requires the model has specific items.
*/
class OMNIUI_SCENE_CLASS_API AbstractManipulatorModel
{
public:
class AbstractManipulatorItem
{
public:
virtual ~AbstractManipulatorItem() = default;
};
using ItemChangedCallback =
std::function<void(const AbstractManipulatorModel*, const AbstractManipulatorModel::AbstractManipulatorItem*)>;
OMNIUI_SCENE_API
virtual ~AbstractManipulatorModel();
/**
* @brief Returns the items that represents the identifier.
*/
OMNIUI_SCENE_API
virtual std::shared_ptr<const AbstractManipulatorItem> getItem(const std::string& identifier);
/**
* @brief Returns the float values of the item.
*/
OMNIUI_SCENE_API
virtual std::vector<Float> getAsFloats(const std::shared_ptr<const AbstractManipulatorItem>& item) = 0;
/**
* @brief Returns the int values of the item.
*/
OMNIUI_SCENE_API
virtual std::vector<int64_t> getAsInts(const std::shared_ptr<const AbstractManipulatorItem>& item) = 0;
/**
* @brief Sets the float values of the item.
*/
OMNIUI_SCENE_API
virtual void setFloats(const std::shared_ptr<const AbstractManipulatorItem>& item, std::vector<Float> value) = 0;
/**
* @brief Sets the int values of the item.
*/
OMNIUI_SCENE_API
virtual void setInts(const std::shared_ptr<const AbstractManipulatorItem>& item, std::vector<int64_t> value) = 0;
/**
* @brief Subscribe ManipulatorModelHelper to the changes of the model.
*
* We need to use regular pointers because we subscribe in the constructor
* of the widget and unsubscribe in the destructor. In constructor smart
* pointers are not available. We also don't allow copy and move of the
* widget.
*/
OMNIUI_SCENE_API
void subscribe(ManipulatorModelHelper* manipulator);
/**
* @brief Unsubscribe the ItemModelHelper widget from the changes of the
* model.
*/
OMNIUI_SCENE_API
void unsubscribe(ManipulatorModelHelper* manipulator);
/**
* @brief Adds the function that will be called every time the value
* changes.
*
* @return The id of the callback that is used to remove the callback.
*/
OMNIUI_SCENE_API
uint32_t addItemChangedFn(ItemChangedCallback&& fn);
/**
* @brief Remove the callback by its id.
*
* @param id The id that addValueChangedFn returns.
*/
OMNIUI_SCENE_API
void removeItemChangedFn(uint32_t id);
protected:
/**
* @brief Called when any data of the model is changed. It will notify the subscribed widgets.
*
* @param item The item in the model that is changed. If it's NULL, the root is changed.
*/
OMNIUI_SCENE_API
void _itemChanged(const std::shared_ptr<const AbstractManipulatorItem>& item);
private:
// All the widgets who use this model.
std::unordered_set<ManipulatorModelHelper*> m_manipulators;
// All the callbacks.
std::vector<ItemChangedCallback> m_itemChangedCallbacks;
// If the derived model doesn't want to create new items, the default
// implementation will do it.
std::map<std::string, std::shared_ptr<const AbstractManipulatorItem>> m_defaultItems;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/DoubleClickGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "ClickGesture.h"
#include "Object.h"
#include <chrono>
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
/**
* @brief The gesture that provides a way to capture double clicks.
*/
class OMNIUI_SCENE_CLASS_API DoubleClickGesture : public ClickGesture
{
OMNIUI_GESTURE_OBJECT(DoubleClickGesture)
public:
OMNIUI_SCENE_API
~DoubleClickGesture();
/**
* @brief Called before processing to determine the state of the gesture.
*/
OMNIUI_SCENE_API
void preProcess(const Matrix44& projection, const Matrix44& view) override;
protected:
/**
* @brief Construct the gesture to track double clicks
*
* @param onEnded Called when the user double clicked
*/
OMNIUI_SCENE_API
DoubleClickGesture(std::function<void(AbstractShape const*)> onEnded = nullptr);
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/bind/BindManipulator.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractContainer.h"
#include "DocManipulator.h"
#include "DocManipulatorModelHelper.h"
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::Manipulator, Manipulator);
// clang-format off
#define OMNIUI_PYBIND_INIT_PyManipulator \
OMNIUI_PYBIND_INIT_AbstractContainer \
OMNIUI_PYBIND_INIT_CAST(model, setModel, std::shared_ptr<AbstractManipulatorModel>) \
OMNIUI_PYBIND_INIT_CAST(gesture, addGesture, std::shared_ptr<ManipulatorGesture>) \
OMNIUI_PYBIND_INIT_CAST(gestures, setGestures, std::vector<std::shared_ptr<ManipulatorGesture>>) \
OMNIUI_PYBIND_INIT_CALLBACK(on_build_fn, setOnBuildFn, void(Manipulator const*))
#define OMNIUI_PYBIND_KWARGS_DOC_Manipulator \
"\n `model : `\n " \
OMNIUI_PYBIND_DOC_ManipulatorModelHelper_getModel \
"\n `gesture : `\n " \
OMNIUI_PYBIND_DOC_Manipulator_getGestures \
"\n `gestures : `\n " \
OMNIUI_PYBIND_DOC_Manipulator_getGestures \
"\n `on_build_fn : `\n " \
OMNIUI_PYBIND_DOC_Manipulator_onBuild \
OMNIUI_PYBIND_KWARGS_DOC_AbstractContainer
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/BindManipulatorGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractGesture.h"
#include "DocManipulatorGesture.h"
#include <omni/ui/bind/BindUtils.h>
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::ManipulatorGesture, ManipulatorGesture);
#define OMNIUI_PYBIND_INIT_ManipulatorGesture OMNIUI_PYBIND_INIT_AbstractGesture
#define OMNIUI_PYBIND_INIT_PyManipulatorGesture OMNIUI_PYBIND_INIT_ManipulatorGesture
#define OMNIUI_PYBIND_KWARGS_DOC_ManipulatorGesture OMNIUI_PYBIND_KWARGS_DOC_AbstractGesture
#define OMNIUI_PYBIND_KWARGS_DOC_PyManipulatorGesture OMNIUI_PYBIND_KWARGS_DOC_ManipulatorGesture
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
class PyManipulatorGesture : public ManipulatorGesture
{
public:
static std::shared_ptr<PyManipulatorGesture> create(pybind11::handle derivedFrom);
void process() override;
const pybind11::handle& getHandle() const;
private:
pybind11::handle m_derivedFrom;
};
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/bind/BindDoubleClickGesture.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindClickGesture.h"
#include "DocDoubleClickGesture.h"
#include <omni/ui/scene/DoubleClickGesture.h>
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::DoubleClickGesture, DoubleClickGesture);
// clang-format off
#define OMNIUI_PYBIND_INIT_PyDoubleClickGesture \
OMNIUI_PYBIND_INIT_PyClickGesture
#define OMNIUI_PYBIND_KWARGS_DOC_DoubleClickGesture \
OMNIUI_PYBIND_KWARGS_DOC_ClickGesture
#define OMNIUI_PYBIND_DOC_DoubleClickGesture_OnEnded OMNIUI_PYBIND_DOC_ClickGesture_OnEnded
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/DocTransform.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Transform \
"Transforms children with component affine transformations.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Transform_transform "Single transformation matrix.\n"
#define OMNIUI_PYBIND_DOC_Transform_scaleTo \
"Which space the current transform will be rescaled before applying the matrix. It's useful to make the object the same size regardless the distance to the camera.\n"
#define OMNIUI_PYBIND_DOC_Transform_lookAt "Rotates this transform to align the direction with the camera.\n"
#define OMNIUI_PYBIND_DOC_Transform_basis "A custom basis for representing this transform's coordinate system.\n"
#define OMNIUI_PYBIND_DOC_Transform_Transform "Constructor.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocSceneContainerScopeBase.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_SceneContainerScopeBase \
"Puts the given container to the top of the stack when this object is constructed. And removes this container when it's destructed.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_SceneContainerScopeBase_get "Returns the container it was created with.\n"
#define OMNIUI_PYBIND_DOC_SceneContainerScopeBase_isValid \
"Checks if this object is valid. It's always valid untill it's invalidated. Once it's invalidated, there is no way to make it valid again.\n"
#define OMNIUI_PYBIND_DOC_SceneContainerScopeBase_invalidate "Makes this object invalid.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocScreen.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Screen \
"The empty shape that triggers all the gestures at any place. Is used to track gestures when the user clicked the empty space. For example for cameras.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Screen_getGesturePayload "Contains all the information about the intersection.\n"
#define OMNIUI_PYBIND_DOC_Screen_getGesturePayload01 \
"Contains all the information about the intersection at the specific state.\n"
#define OMNIUI_PYBIND_DOC_Screen_Screen "Constructor.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocSceneContainerStack.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_SceneContainerStack \
"Singleton object that holds the stack of containers. We use it to automatically add widgets to the top container when the widgets are created.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_SceneContainerStack_push \
"Push the container to the top of the stack. All the newly created widgets will be added to this container.\n"
#define OMNIUI_PYBIND_DOC_SceneContainerStack_pop \
"Removes the container from the stack. The previous one will be active.\n"
#define OMNIUI_PYBIND_DOC_SceneContainerStack_addChildToTop "Add the given widget to the top container.\n"
#define OMNIUI_PYBIND_DOC_SceneContainerStack_instance "The only instance of the singleton.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindSpace.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractContainer.h"
#define OMNIUI_PYBIND_INIT_Space
#define OMNIUI_PYBIND_KWARGS_DOC_Space
|
omniverse-code/kit/include/omni/ui/scene/bind/BindAbstractShape.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractItem.h"
#include "DocAbstractShape.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_AbstractShape \
OMNIUI_PYBIND_INIT_CALL(gesture, setGestures, pythonToGestures) \
OMNIUI_PYBIND_INIT_CALL(gestures, setGestures, pythonToGestures) \
OMNIUI_PYBIND_INIT_AbstractItem
#define OMNIUI_PYBIND_KWARGS_DOC_AbstractShape \
"\n `gesture : `\n " \
OMNIUI_PYBIND_DOC_AbstractShape_getGestures \
"\n `gestures : `\n " \
OMNIUI_PYBIND_DOC_AbstractShape_getGestures \
OMNIUI_PYBIND_KWARGS_DOC_AbstractItem
// clang-format on
OMNIUI_SCENE_NAMESPACE_OPEN_SCOPE
std::vector<std::shared_ptr<ShapeGesture>> pythonToGestures(pybind11::handle obj);
OMNIUI_SCENE_NAMESPACE_CLOSE_SCOPE
|
omniverse-code/kit/include/omni/ui/scene/bind/DocAbstractDrawSystem.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_AbstractDrawSystem \
"The InvisibleButton widget provides a transparent command button.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindTransform.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractContainer.h"
#include "DocTransform.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_Transform \
OMNIUI_PYBIND_INIT_AbstractContainer \
OMNIUI_PYBIND_INIT_CALL(transform, setTransform, pythonToMatrix4) \
OMNIUI_PYBIND_INIT_CAST(scale_to, setScaleTo, Space) \
OMNIUI_PYBIND_INIT_CAST(look_at, setLookAt, Transform::LookAt) \
OMNIUI_PYBIND_INIT_CAST(basis, setBasis, std::shared_ptr<TransformBasis>)
#define OMNIUI_PYBIND_KWARGS_DOC_Transform \
"\n `transform : `\n " \
OMNIUI_PYBIND_DOC_Transform_transform \
"\n `scale_to : `\n " \
OMNIUI_PYBIND_DOC_Transform_scaleTo \
"\n `look_at : `\n " \
OMNIUI_PYBIND_DOC_Transform_lookAt \
"\n `basis : `\n " \
OMNIUI_PYBIND_DOC_Transform_basis \
OMNIUI_PYBIND_KWARGS_DOC_AbstractContainer
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/BindLabel.h | // Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractShape.h"
#include "DocLabel.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_Label \
OMNIUI_PYBIND_INIT_AbstractShape \
OMNIUI_PYBIND_INIT_CALL(color, setColor, pythonToColor4) \
OMNIUI_PYBIND_INIT_CAST(size, setSize, float) \
OMNIUI_PYBIND_INIT_CAST(alignment, setAlignment, Alignment) \
OMNIUI_PYBIND_INIT_CAST(text, setText, std::string)
#define OMNIUI_PYBIND_KWARGS_DOC_Label \
"\n `color : `\n " \
OMNIUI_PYBIND_DOC_Label_color \
"\n `size : `\n " \
OMNIUI_PYBIND_DOC_Label_size \
"\n `alignment : `\n " \
OMNIUI_PYBIND_DOC_Label_alignment \
"\n `text : `\n " \
OMNIUI_PYBIND_DOC_Label_text \
OMNIUI_PYBIND_KWARGS_DOC_AbstractShape
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/DocShapeGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ShapeGesture \
"The base class for the gestures to provides a way to capture mouse events in 3d scene.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ShapeGesture_dispatchInput \
"Called by scene to process the mouse inputs and do intersections with shapes. It can be an entry point to simulate the mouse input.\n" \
"Todo\n" \
"We probably don't need projection-view here. We can get it from manager.\n"
#define OMNIUI_PYBIND_DOC_ShapeGesture_getSender "Returns the relevant shape driving the gesture.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocMouseInput.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_MouseInput \
"\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocAbstractContainer.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_AbstractContainer \
"Base class for all the items that have children.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_AbstractContainer_transformSpace \
"Transform the given point from the coordinate system fromspace to the coordinate system tospace.\n"
#define OMNIUI_PYBIND_DOC_AbstractContainer_transformSpace01 \
"Transform the given vector from the coordinate system fromspace to the coordinate system tospace.\n"
#define OMNIUI_PYBIND_DOC_AbstractContainer_addChild \
"Adds item to this container in a manner specific to the container. If it's allowed to have one sub-widget only, it will be overwriten.\n"
#define OMNIUI_PYBIND_DOC_AbstractContainer_clear "Removes the container items from the container.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocScrollGesture.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ScrollGesture \
"The gesture that provides a way to capture mouse scroll event.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_preProcess "Called before processing to determine the state of the gesture.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_process "Process the gesture and call callbacks if necessary.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_onEnded "Called if the callback is not set when the user scrolls.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_mouseButton "The mouse button this gesture is watching.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_modifiers "The modifier that should be pressed to trigger this gesture.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_OnEnded "Called when the user scrolls.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_getScroll "Returns the current scroll state.\n"
#define OMNIUI_PYBIND_DOC_ScrollGesture_ScrollGesture \
"Constructs an gesture to track when the user clicked the mouse.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `onEnded :`\n" \
" Function that is called when the user clicked the mouse button.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindAbstractContainer.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractItem.h"
#include "DocAbstractContainer.h"
#define OMNIUI_PYBIND_INIT_AbstractContainer OMNIUI_PYBIND_INIT_AbstractItem
#define OMNIUI_PYBIND_KWARGS_DOC_AbstractContainer OMNIUI_PYBIND_KWARGS_DOC_AbstractItem
|
omniverse-code/kit/include/omni/ui/scene/bind/BindScene.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractContainer.h"
#include "DocScene.h"
#define OMNIUI_PYBIND_INIT_Scene OMNIUI_PYBIND_INIT_AbstractContainer
#define OMNIUI_PYBIND_KWARGS_DOC_Scene OMNIUI_PYBIND_KWARGS_DOC_AbstractContainer
|
omniverse-code/kit/include/omni/ui/scene/bind/DocClickGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ClickGesture \
"The gesture that provides a way to capture click mouse event.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_preProcess "Called before processing to determine the state of the gesture.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_process "Process the gesture and call callbacks if necessary.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_onEnded \
"Called if the callback is not set when the user releases the mouse button.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_mouseButton "The mouse button this gesture is watching.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_modifiers "The modifier that should be pressed to trigger this gesture.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_OnEnded "Called when the user releases the button.\n"
#define OMNIUI_PYBIND_DOC_ClickGesture_ClickGesture \
"Constructs an gesture to track when the user clicked the mouse.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `onEnded :`\n" \
" Function that is called when the user clicked the mouse button.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocPropertyCallback.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_PropertyCallback \
"Callback containers that is used with OMNIUI_PROPERTY macro.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocTexturedMesh.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_TexturedMesh \
"Encodes a polygonal mesh with free-form textures.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_getGesturePayload "Contains all the information about the intersection.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_getGesturePayload01 \
"Contains all the information about the intersection at the specific state.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_uvs \
"This property holds the texture coordinates of the mesh.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_sourceUrl \
"This property holds the image URL. It can be an \"omni:\" path, a \"file:\" path, a direct path or the path " \
"relative to the application root directory.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_imageProvider \
"This property holds the image provider. It can be an \"omni:\" path, a \"file:\" path, a direct path or the " \
"path relative to the application root directory.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_imageWidth \
"This property holds the image width\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_imageHeight \
"This property holds the image height\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_TexturedMesh \
"Construct a mesh with predefined properties.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `sourceUrl :`\n" \
" Describes the texture image url.\n" \
"\n" \
" `uvs :`\n" \
" Describes uvs for the image texture.\n" \
"\n" \
" `positions :`\n" \
" Describes points in local space.\n" \
"\n" \
" `colors :`\n" \
" Describes colors per vertex.\n" \
"\n" \
" `vertexCounts :`\n" \
" The number of vertices in each face.\n" \
"\n" \
" `vertexIndices :`\n" \
" The list of the index of each vertex of each face in the mesh.\n"
#define OMNIUI_PYBIND_DOC_TexturedMesh_TexturedMesh01 \
"Construct a mesh with predefined properties.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `imageProvider :`\n" \
" Describes the texture image provider.\n" \
"\n" \
" `uvs :`\n" \
" Describes uvs for the image texture.\n" \
"\n" \
" `positions :`\n" \
" Describes points in local space.\n" \
"\n" \
" `colors :`\n" \
" Describes colors per vertex.\n" \
"\n" \
" `vertexCounts :`\n" \
" The number of vertices in each face.\n" \
"\n" \
" `vertexIndices :`\n" \
" The list of the index of each vertex of each face in the mesh.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocSceneContainerScope.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_SceneContainerScope \
"The templated class SceneContainerScope creates a new container and puts it to the top of the stack.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocLabel.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Label \
"\n" \
"Defines a standard label for user interface items\n"
#define OMNIUI_PYBIND_DOC_Label_text "This property holds the label's text.\n"
#define OMNIUI_PYBIND_DOC_Label_color "The color of the text.\n"
#define OMNIUI_PYBIND_DOC_Label_alignment \
"This property holds the alignment of the label's contents. By default, the contents of the label are left-aligned and vertically-centered.\n"
#define OMNIUI_PYBIND_DOC_Label_size "The font size.\n"
#define OMNIUI_PYBIND_DOC_Label_Label \
"A standard label for user interface items.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `text :`\n" \
" The string with the text to display\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocImage.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Image \
"\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Image_sourceUrl \
"This property holds the image URL. It can be an \"omni:\" path, a \"file:\" path, a direct path or the path " \
"relative to the application root directory.\n"
#define OMNIUI_PYBIND_DOC_Image_imageProvider \
"This property holds the image provider. It can be an \"omni:\" path, a \"file:\" path, a direct path or the path "\
"relative to the application root directory.\n"
#define OMNIUI_PYBIND_DOC_Image_fillPolicy \
"Define what happens when the source image has a different size than the item.\n"
#define OMNIUI_PYBIND_DOC_Image_Image "Created an image with the given URL.\n"
#define OMNIUI_PYBIND_DOC_Image_Image01 "Created an image with the given provider.\n"
#define OMNIUI_PYBIND_DOC_Image_Image2 "Created an empty image.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindPoints.h | // Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractShape.h"
#include "DocPoints.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_Points \
OMNIUI_PYBIND_INIT_AbstractShape \
OMNIUI_PYBIND_INIT_CALL(positions, setPositions, pythonListToVector3) \
OMNIUI_PYBIND_INIT_CALL(colors, setColors, pythonListToVector4) \
OMNIUI_PYBIND_INIT_CAST(sizes, setSizes, std::vector<float>) \
OMNIUI_PYBIND_INIT_CAST(intersection_sizes, setIntersectionSize, float)
#define OMNIUI_PYBIND_KWARGS_DOC_Points \
"\n `positions : `\n " \
OMNIUI_PYBIND_DOC_Points_positions \
"\n `colors : `\n " \
OMNIUI_PYBIND_DOC_Points_colors \
"\n `sizes : `\n " \
OMNIUI_PYBIND_DOC_Points_sizes \
"\n `intersection_sizes : `\n " \
OMNIUI_PYBIND_DOC_Points_intersectionSize \
OMNIUI_PYBIND_KWARGS_DOC_AbstractShape
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/DocSceneContainerScope301Void014.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_SceneContainerScope \
< void > \
"Specialization. It takes existing container and puts it to the top of the stack.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocSceneView.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_SceneView \
"The widget to render omni.ui.scene.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_SceneView_getProjection \
"The camera projection matrix. It's a shortcut for Matrix44(SceneView.model.get_as_floats(\"projection\"))\n"
#define OMNIUI_PYBIND_DOC_SceneView_getView \
"The camera view matrix. It's a shortcut for Matrix44(SceneView.model.get_as_floats(\"view\"))\n"
#define OMNIUI_PYBIND_DOC_SceneView_onModelUpdated \
"Called by the model when the model value is changed. The class should react to the changes.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `item :`\n" \
" The item in the model that is changed. If it's NULL, the root is changed.\n\n"
#define OMNIUI_PYBIND_DOC_SceneView_scene "The container that holds the shapes, gestures and managers.\n"
#define OMNIUI_PYBIND_DOC_SceneView_screenAspectRatio \
"Aspect ratio of the rendering screen. This screen will be fit to the widget. " \
"SceneView simulates the behavior of the Kit viewport where the rendered image (screen) fits into the viewport " \
"(widget), and the camera has multiple policies that modify the camera projection matrix's aspect ratio to match " \
"it to the screen aspect ratio. " \
"When screen_aspect_ratio is 0, Screen size matches the Widget bounds.\n"
#define OMNIUI_PYBIND_DOC_SceneView_childWindowsInput \
"When it's false, the mouse events from other widgets inside the bounds are ignored. We need it to filter out mouse events from mouse events of widgets in `ui.VStack(content_clipping=1)`.\n"
#define OMNIUI_PYBIND_DOC_SceneView_aspectRatioPolicy \
"Define what happens when the aspect ratio of the camera is different from the aspect ratio of the widget.\n"
#define OMNIUI_PYBIND_DOC_SceneView_SceneView "Constructor.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocDoubleClickGesture.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_DoubleClickGesture \
"The gesture that provides a way to capture double clicks.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_DoubleClickGesture_preProcess \
"Called before processing to determine the state of the gesture.\n"
#define OMNIUI_PYBIND_DOC_DoubleClickGesture_DoubleClickGesture \
"Construct the gesture to track double clicks.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `onEnded :`\n" \
" Called when the user double clicked\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocImguiDrawSystem.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ImguiDrawSystem \
"The InvisibleButton widget provides a transparent command button.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocDrawBuffer.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_DrawBuffer \
"The InvisibleButton widget provides a transparent command button.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocCameraModel.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_CameraModel \
"\n" \
"A model that holds projection and view matrices\n"
#define OMNIUI_PYBIND_DOC_CameraModel_CameraModel "Initialize the camera with the given projection/view matrices.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_getItem "Returns the items that represents the identifier.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_getAsFloats "Returns the float values of the item.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_getAsInts "Returns the int values of the item.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_setFloats "Sets the float values of the item.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_setInts "Sets the int values of the item.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_getProjection "The camera projection matrix.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_getView "The camera view matrix.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_setProjection "Set the camera projection matrix.\n"
#define OMNIUI_PYBIND_DOC_CameraModel_setView "Set the camera view matrix.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocManipulator.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Manipulator \
"The base object for the custom manipulators.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Manipulator_onBuild "Called when Manipulator is dirty to build the content.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_invalidate \
"Make Manipulator dirty so onBuild will be executed in _preDrawContent.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_onModelUpdated \
"Called by the model when the model value is changed. The class should react to the changes.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `item :`\n" \
" The item in the model that is changed. If it's NULL, the root is changed.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_getGestures "All the gestures assigned to this manipulator.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_setGestures "Replace the gestures of the manipulator.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_addGesture "Add a single gesture to the manipulator.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_OnBuild \
"Called when Manipulator is dirty to build the content. It's another way to build the manipulator's content on the case the user doesn't want to reimplement the class.\n"
#define OMNIUI_PYBIND_DOC_Manipulator_Manipulator "Constructor.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindDragGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindShapeGesture.h"
#include "DocDragGesture.h"
#include <omni/ui/scene/DragGesture.h>
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::DragGesture, DragGesture);
// clang-format off
#define OMNIUI_PYBIND_INIT_PyDragGesture \
OMNIUI_PYBIND_INIT_CAST(mouse_button, setMouseButton, uint32_t) \
OMNIUI_PYBIND_INIT_CAST(modifiers, setModifiers, uint32_t) \
OMNIUI_PYBIND_INIT_CAST(check_mouse_moved, setCheckMouseMoved, bool) \
OMNIUI_PYBIND_INIT_CALLBACK(on_began_fn, setOnBeganFn, void(AbstractShape const*)) \
OMNIUI_PYBIND_INIT_CALLBACK(on_changed_fn, setOnChangedFn, void(AbstractShape const*)) \
OMNIUI_PYBIND_INIT_CALLBACK(on_ended_fn, setOnEndedFn, void(AbstractShape const*)) \
OMNIUI_PYBIND_INIT_ShapeGesture
#define OMNIUI_PYBIND_KWARGS_DOC_DragGesture \
"\n `mouse_button : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_mouseButton \
"\n `modifiers : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_modifiers \
"\n `check_mouse_moved : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_checkMouseMoved \
"\n `on_began_fn : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_onBegan \
"\n `on_changed_fn : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_onChanged \
"\n `on_ended_fn : `\n " \
OMNIUI_PYBIND_DOC_DragGesture_onEnded \
OMNIUI_PYBIND_KWARGS_DOC_ShapeGesture
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/BindScreen.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractShape.h"
#include "DocScreen.h"
#define OMNIUI_PYBIND_INIT_Screen OMNIUI_PYBIND_INIT_AbstractShape
#define OMNIUI_PYBIND_KWARGS_DOC_Screen OMNIUI_PYBIND_KWARGS_DOC_AbstractShape
|
omniverse-code/kit/include/omni/ui/scene/bind/DocDragGesture.h | // Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_DragGesture \
"The gesture that provides a way to capture click-and-drag mouse event.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_DragGesture_preProcess "Called before processing to determine the state of the gesture.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_process "Process the gesture and call callbacks if necessary.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_onBegan \
"Called if the callback is not set when the user clicks the mouse button.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_onChanged \
"Called if the callback is not set when the user moves the clicked button.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_onEnded \
"Called if the callback is not set when the user releases the mouse button.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_mouseButton "Mouse button that should be active to start the gesture.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_modifiers "The keyboard modifier that should be active ti start the gesture.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_checkMouseMoved \
"The check_mouse_moved property is a boolean flag that determines whether the DragGesture should verify if the 2D screen position of the mouse has changed before invoking the on_changed method. This property is essential in a 3D environment, as changes in the camera position can result in the mouse pointing to different locations in the 3D world even when the 2D screen position remains unchanged.\n\n" \
"Usage\n" \
"When check_mouse_moved is set to True, the DragGesture will only call the on_changed method if the actual 2D screen position of the mouse has changed. This can be useful when you want to ensure that the on_changed method is only triggered when there is a genuine change in the mouse's 2D screen position.\n" \
"If check_mouse_moved is set to False, the DragGesture will not check for changes in the mouse's 2D screen position before calling the on_changed method. This can be useful when you want the on_changed method to be invoked even if the mouse's 2D screen position hasn't changed, such as when the camera position is altered, and the mouse now points to a different location in the 3D world.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_OnBegan "Called when the user starts drag.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_OnChanged "Called when the user is dragging.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_OnEnded "Called when the user releases the mouse and finishes the drag.\n"
#define OMNIUI_PYBIND_DOC_DragGesture_DragGesture "Construct the gesture to track mouse drags.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocPoints.h | // Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Points \
"Represents the point cloud.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_Points_getGesturePayload "Contains all the information about the intersection.\n"
#define OMNIUI_PYBIND_DOC_Points_getGesturePayload01 \
"Contains all the information about the intersection at the specific state.\n"
#define OMNIUI_PYBIND_DOC_Points_getIntersectionDistance \
"The distance in pixels from mouse pointer to the shape for the intersection.\n"
#define OMNIUI_PYBIND_DOC_Points_positions "List with positions of the points.\n"
#define OMNIUI_PYBIND_DOC_Points_colors "List of colors of the points.\n"
#define OMNIUI_PYBIND_DOC_Points_sizes "List of point sizes.\n"
#define OMNIUI_PYBIND_DOC_Points_intersectionSize "The size of the points for the intersection.\n"
#define OMNIUI_PYBIND_DOC_Points_Points \
"Constructs the point cloud object.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `positions :`\n" \
" List of positions\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocMatrix44.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Matrix44 \
"Stores a 4x4 matrix of float elements. A basic type.\n" \
"Matrices are defined to be in row-major order.\n" \
"The matrix mode is required to define the matrix that resets the transformation to fit the geometry into NDC, Screen space, or rotate it to the camera direction.\n"
#define OMNIUI_PYBIND_DOC_Matrix44_setLookAtView \
"Rotates the matrix to be aligned with the camera.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `view :`\n" \
" The view matrix of the camera\n"
#define OMNIUI_PYBIND_DOC_Matrix44_getTranslationMatrix \
"Creates a matrix to specify a translation at the given coordinates.\n"
#define OMNIUI_PYBIND_DOC_Matrix44_getRotationMatrix \
"Creates a matrix to specify a rotation around each axis.\n" \
"\n" \
"\n" \
"### Arguments:\n" \
"\n" \
" `degrees :`\n" \
" true if the angles are specified in degrees\n"
#define OMNIUI_PYBIND_DOC_Matrix44_getScaleMatrix \
"Creates a matrix to specify a scaling with the given scale factor per axis.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocCallback.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_Callback \
"Callback containers that is used with OMNIUI_CALLBACK macro. It keeps only one function, but it's possible to set up another function called when the main one is replaced.\n" \
"\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocImageHelper.h | // Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ImageHelper \
"The helper class for the widgets that are working with image, e.g. sc.Image and sc.TexturedMesh.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ImageHelper_imageWidth "The resolution for rasterization of svg and for ImageProvider.\n"
#define OMNIUI_PYBIND_DOC_ImageHelper_imageHeight "The resolution of rasterization of svg and for ImageProvider.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/DocAbstractItem.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_AbstractItem \
"\n" \
"\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_destroy "Removes all the callbacks and circular references.\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_transformSpace \
"Transform the given point from the coordinate system fromspace to the coordinate system tospace.\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_transformSpace01 \
"Transform the given vector from the coordinate system fromspace to the coordinate system tospace.\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_computeVisibility \
"Calculate the effective visibility of this prim, as defined by its most ancestral invisible opinion, if any.\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_sceneView "The current SceneView this item is parented to.\n"
#define OMNIUI_PYBIND_DOC_AbstractItem_visible "This property holds whether the item is visible.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindAbstractGesture.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "DocAbstractGesture.h"
#include <omni/ui/bind/BindUtils.h>
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::AbstractGesture, AbstractGesture);
// clang-format off
#define OMNIUI_PYBIND_INIT_AbstractGesture \
OMNIUI_PYBIND_INIT_CAST(name, setName, std::string) \
OMNIUI_PYBIND_INIT_CAST(manager, setManager, std::shared_ptr<GestureManager>)
#define OMNIUI_PYBIND_KWARGS_DOC_AbstractGesture \
"\n `name : `\n " \
OMNIUI_PYBIND_DOC_AbstractGesture_name \
"\n `manager : `\n " \
OMNIUI_PYBIND_DOC_AbstractGesture_getManager
// clang-format on
|
omniverse-code/kit/include/omni/ui/scene/bind/BindShapeGesture.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindAbstractGesture.h"
#include "DocShapeGesture.h"
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::ShapeGesture, ShapeGesture);
#define OMNIUI_PYBIND_INIT_ShapeGesture OMNIUI_PYBIND_INIT_AbstractGesture
#define OMNIUI_PYBIND_KWARGS_DOC_ShapeGesture OMNIUI_PYBIND_KWARGS_DOC_AbstractGesture
|
omniverse-code/kit/include/omni/ui/scene/bind/BindAbstractManipulatorModel.h | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "DocAbstractManipulatorModel.h"
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::AbstractManipulatorModel, AbstractManipulatorModel);
OMNIUI_PROTECT_PYBIND11_OBJECT(OMNIUI_SCENE_NS::AbstractManipulatorModel::AbstractManipulatorItem,
AbstractManipulatorItem);
#define OMNIUI_PYBIND_INIT_AbstractManipulatorModel
#define OMNIUI_PYBIND_KWARGS_DOC_AbstractManipulatorModel
|
omniverse-code/kit/include/omni/ui/scene/bind/DocManipulatorGesture.h | // Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#define OMNIUI_PYBIND_DOC_ManipulatorGesture \
"The base class for the gestures to provides a way to capture events of the manipulator objects.\n" \
"\n"
#define OMNIUI_PYBIND_DOC_ManipulatorGesture_dispatchInput \
"Called by scene to process the mouse inputs and do intersections with shapes. It can be an entry point to simulate the mouse input.\n" \
"Todo\n" \
"We probably don't need projection-view here. We can get it from manager.\n"
#define OMNIUI_PYBIND_DOC_ManipulatorGesture_preProcess \
"Called before processing to determine the state of the gesture.\n"
#define OMNIUI_PYBIND_DOC_ManipulatorGesture_getSender "Returns the relevant shape driving the gesture.\n"
#define OMNIUI_PYBIND_DOC_ManipulatorGesture_ManipulatorGesture "Constructor.\n"
|
omniverse-code/kit/include/omni/ui/scene/bind/BindImage.h | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "BindRectangle.h"
#include "DocImage.h"
#include "DocImageHelper.h"
// clang-format off
#define OMNIUI_PYBIND_INIT_Image \
OMNIUI_PYBIND_INIT_Rectangle \
OMNIUI_PYBIND_INIT_CAST(source_url, setSourceUrl, std::string) \
OMNIUI_PYBIND_INIT_CAST(image_provider, setImageProvider, std::shared_ptr<ImageProvider>) \
OMNIUI_PYBIND_INIT_CAST(fill_policy, setFillPolicy, Image::FillPolicy) \
OMNIUI_PYBIND_INIT_CAST(image_width, setImageWidth, uint32_t) \
OMNIUI_PYBIND_INIT_CAST(image_height, setImageHeight, uint32_t) \
#define OMNIUI_PYBIND_KWARGS_DOC_Image \
"\n `source_url : `\n " \
OMNIUI_PYBIND_DOC_Image_sourceUrl \
"\n `image_provider : `\n " \
OMNIUI_PYBIND_DOC_Image_imageProvider \
"\n `fill_policy : `\n " \
OMNIUI_PYBIND_DOC_Image_fillPolicy \
"\n `image_width : `\n " \
OMNIUI_PYBIND_DOC_ImageHelper_imageWidth \
"\n `image_height : `\n " \
OMNIUI_PYBIND_DOC_ImageHelper_imageHeight \
OMNIUI_PYBIND_KWARGS_DOC_Rectangle
// clang-format on
|
Subsets and Splits