file_path
stringlengths 21
207
| content
stringlengths 5
1.02M
| size
int64 5
1.02M
| lang
stringclasses 9
values | avg_line_length
float64 1.33
100
| max_line_length
int64 4
993
| alphanum_fraction
float64 0.27
0.93
|
---|---|---|---|---|---|---|
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/vec4d.h | // Copyright (c) 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 <usdrt/gf/vec.h>
| 477 | C | 35.769228 | 77 | 0.784067 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/vec3d.h | // Copyright (c) 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 <usdrt/gf/vec.h>
| 477 | C | 35.769228 | 77 | 0.784067 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/vec4h.h | // Copyright (c) 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 <usdrt/gf/vec.h>
| 477 | C | 35.769228 | 77 | 0.784067 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/quatd.h | // Copyright (c) 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 <usdrt/gf/quat.h>
| 478 | C | 35.846151 | 77 | 0.784519 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/vec3i.h | // Copyright (c) 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 <usdrt/gf/vec.h>
| 477 | C | 35.769228 | 77 | 0.784067 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/gf/range3d.h | // Copyright (c) 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 <usdrt/gf/range.h>
| 479 | C | 35.923074 | 77 | 0.784969 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/tf/token.h | // Copyright (c) 2021-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
//! @file
//!
//! @brief TODO
#include <omni/fabric/IToken.h>
#include <string>
namespace usdrt
{
class TfToken
{
public:
TfToken();
TfToken(const omni::fabric::Token& token);
TfToken(const std::string& token);
TfToken(const char* token);
const std::string GetString() const;
const char* GetText() const;
void pyUpdate(const char* fromPython);
// TODO: other TfToken APIs
bool IsEmpty() const;
bool operator==(const TfToken& other) const;
bool operator!=(const TfToken& other) const;
bool operator<(const TfToken& other) const;
operator omni::fabric::TokenC() const;
private:
omni::fabric::Token m_token;
};
inline TfToken::TfToken()
{
// m_token constructs uninitialized by default
}
inline TfToken::TfToken(const omni::fabric::Token& token) : m_token(token)
{
}
inline TfToken::TfToken(const std::string& token) : m_token(token.c_str())
{
}
inline TfToken::TfToken(const char* token) : m_token(token)
{
}
inline bool TfToken::operator==(const TfToken& other) const
{
return m_token == other.m_token;
}
inline bool TfToken::operator!=(const TfToken& other) const
{
return !(m_token == other.m_token);
}
inline bool TfToken::operator<(const TfToken& other) const
{
return m_token < other.m_token;
}
inline TfToken::operator omni::fabric::TokenC() const
{
return omni::fabric::TokenC(m_token);
}
inline const std::string TfToken::GetString() const
{
return m_token.getString();
}
inline const char* TfToken::GetText() const
{
return m_token.getText();
}
inline void TfToken::pyUpdate(const char* fromPython)
{
m_token = omni::fabric::Token(fromPython);
}
inline bool TfToken::IsEmpty() const
{
return m_token == omni::fabric::kUninitializedToken;
}
typedef std::vector<TfToken> TfTokenVector;
}
| 2,261 | C | 20.339622 | 77 | 0.704113 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/base/vt/array.h | // Copyright (c) 2022-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
//! @file
//!
//! @brief TODO
#include <gsl/span>
#include <omni/fabric/IFabric.h>
#include <omni/python/PyBind.h>
#include <memory>
namespace usdrt
{
/* VtArray can:
* own its own CPU memory via a std::vector<ElementType> which follows COW semantics the same way Pixar's VtArray does
* refer to a Fabric CPU/GPU attribute via a stage ID, a path and an attribute
* refer to an external CPU python array (numpy) or GPU python array (pytorch/warp)
*/
template <typename ElementType>
class VtArray
{
public:
using element_type = ElementType;
using value_type = std::remove_cv_t<ElementType>;
using size_type = std::size_t;
using pointer = element_type*;
using const_pointer = const element_type*;
using reference = element_type&;
using const_reference = const element_type&;
using difference_type = std::ptrdiff_t;
VtArray();
VtArray(const VtArray<ElementType>& other);
VtArray(VtArray<ElementType>&& other);
VtArray(size_t n);
VtArray(gsl::span<ElementType> span);
VtArray(const std::vector<ElementType>& vec);
VtArray(size_t n, ElementType* data, void* gpuData, const py::object& externalArray = py::none());
VtArray(std::initializer_list<ElementType> initList);
VtArray(omni::fabric::StageReaderWriterId stageId, omni::fabric::PathC path, omni::fabric::TokenC attr);
~VtArray();
VtArray& operator=(const VtArray<ElementType>& other);
VtArray& operator=(gsl::span<ElementType> other);
VtArray& operator=(std::initializer_list<ElementType> initList);
ElementType& operator[](size_t index);
ElementType const& operator[](size_t index) const;
size_t size() const;
size_t capacity() const;
bool empty() const;
void reset();
void resize(size_t newSize);
void reserve(size_t num);
void push_back(const ElementType& element);
pointer data()
{
detach();
return span().data();
}
const_pointer data() const
{
return span().data();
}
const_pointer cdata() const
{
return span().data();
}
gsl::span<ElementType> span() const;
// Special RT functionality...
// When a VtArray is initialized from Fabric data,
// generally with UsdAttribute.Get(),
// its underlying span will point at data directly in
// Fabric. In this default attached state, the VtArray
// can be used to modify Fabric arrays directly.
// The developer may choose to make an instance-local
// copy of the array data using DetachFromSource, at
// which point modifications happen on the instance-local
// array. IsFabricData() will let you know if a VtArray
// instance is reading/writing Fabric data directly.
void DetachFromSource();
bool IsFabricData() const;
bool IsPythonData() const;
bool IsOwnData() const;
bool HasFabricCpuData() const;
bool HasFabricGpuData() const;
void* GetGpuData() const;
typedef gsl::details::span_iterator<ElementType> iterator;
typedef gsl::details::span_iterator<const ElementType> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
iterator begin()
{
detach();
return span().begin();
}
iterator end()
{
return span().end();
}
const_iterator cbegin()
{
return span().begin();
}
const_iterator cend()
{
return span().end();
}
reverse_iterator rbegin()
{
detach();
return reverse_iterator(span().end());
}
reverse_iterator rend()
{
return reverse_iterator(span().begin());
}
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(span().end());
}
const_reverse_iterator rend() const
{
return const_reverse_iterator(span().begin());
}
const_reverse_iterator crbegin() const
{
return rbegin();
}
const_reverse_iterator crend() const
{
return rend();
}
private:
// If the m_data span is pointing at fabric data,
// or if multiple VtArray instances are pointing
// at the same underlying data, make a copy
// of the data that is unique to this instance.
// This is used to implement Copy On Write
// and Copy On Non-Const Access, like Pixar's VtArray
void detach();
// Make an copy of data from iterable source that
// is unique to this instance.
template <typename Source>
void localize(const Source& other);
size_t m_size = 0;
size_t m_capacity = 0;
ElementType* m_data = nullptr;
void* m_gpuData = nullptr;
// Use a shared_ptr for lazy reference counting
// in order to implement COW/CONCA functionality.
std::shared_ptr<gsl::span<ElementType>> m_sharedData;
// When a VtArray points to Fabric data we avoid using pointers which can change
// without notice, instead we use Path and Attribute.
omni::fabric::StageReaderWriterId m_stageId{ 0 };
omni::fabric::PathC m_path{ 0 };
omni::fabric::TokenC m_attr{ 0 };
// When creating a VtArray from an external python object (buffer or cuda array interface)
// we keep a reference to the external object in order to keep it alive until the VtArray is destroyed.
py::object m_externalArray = py::none();
};
template <typename ElementType>
inline VtArray<ElementType>::VtArray()
{
m_sharedData = std::make_shared<gsl::span<ElementType>>();
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(const VtArray<ElementType>& other)
: m_size(other.m_size),
m_capacity(other.m_capacity),
m_data(other.m_data),
m_gpuData(other.m_gpuData),
m_sharedData(other.m_sharedData),
m_stageId(other.m_stageId),
m_path(other.m_path),
m_attr(other.m_attr),
m_externalArray(other.m_externalArray)
{
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(VtArray<ElementType>&& other)
: m_size(other.m_size),
m_capacity(other.m_capacity),
m_data(other.m_data),
m_gpuData(other.m_gpuData),
m_sharedData(std::move(other.m_sharedData)),
m_stageId(other.m_stageId),
m_path(other.m_path),
m_attr(other.m_attr),
m_externalArray(std::move(other.m_externalArray))
{
other.m_data = nullptr;
other.m_size = 0;
other.m_capacity = 0;
other.m_gpuData = nullptr;
other.m_stageId.id = 0;
other.m_path.path = 0;
other.m_attr.token = 0;
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(size_t n) : m_size(n), m_capacity(n)
{
m_sharedData = std::make_shared<gsl::span<ElementType>>(new ElementType[m_size], m_size);
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(gsl::span<ElementType> span) : m_size(span.size()), m_capacity(span.size())
{
localize(span);
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(size_t n, ElementType* data, void* gpuData, const py::object& externalArray)
: m_size(n), m_capacity(n), m_data(data), m_gpuData(gpuData), m_externalArray(externalArray)
{
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(omni::fabric::StageReaderWriterId stageId,
omni::fabric::PathC path,
omni::fabric::TokenC attr)
: m_stageId(stageId), m_path(path), m_attr(attr)
{
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(std::initializer_list<ElementType> initList)
{
localize(initList);
}
template <typename ElementType>
inline VtArray<ElementType>::VtArray(const std::vector<ElementType>& vec)
{
localize(vec);
}
template <typename ElementType>
inline VtArray<ElementType>& VtArray<ElementType>::operator=(const VtArray<ElementType>& other)
{
m_size = other.m_size;
m_capacity = other.m_capacity;
m_data = other.m_data;
m_gpuData = other.m_gpuData;
m_sharedData = other.m_sharedData;
m_stageId = other.m_stageId;
m_path = other.m_path;
m_attr = other.m_attr;
m_externalArray = other.m_externalArray;
return *this;
}
template <typename ElementType>
inline VtArray<ElementType>& VtArray<ElementType>::operator=(gsl::span<ElementType> other)
{
localize(other);
return *this;
}
template <typename ElementType>
inline VtArray<ElementType>& VtArray<ElementType>::operator=(std::initializer_list<ElementType> initList)
{
localize(initList);
return *this;
}
template <typename ElementType>
inline ElementType const& VtArray<ElementType>::operator[](size_t index) const
{
return span()[index];
}
template <typename ElementType>
inline ElementType& VtArray<ElementType>::operator[](size_t index)
{
if (m_stageId.id == 0)
{
// Allow writing to Fabric only
detach();
}
return span()[index];
}
template <typename ElementType>
inline VtArray<ElementType>::~VtArray()
{
reset();
}
template <typename ElementType>
inline void VtArray<ElementType>::reset()
{
if (m_sharedData.use_count() == 1 && m_sharedData->data())
{
delete[] m_sharedData->data();
}
m_data = nullptr;
m_gpuData = nullptr;
m_size = 0;
m_capacity = 0;
m_stageId.id = 0;
m_path.path = 0;
m_attr.token = 0;
m_externalArray = py::none();
}
template <typename ElementType>
inline gsl::span<ElementType> VtArray<ElementType>::span() const
{
if (m_sharedData)
{
// Note - the m_sharedData span may be larger than m_size
// if there is reserved capacity, so return a new span
// that has a size of m_size
return gsl::span<ElementType>(m_sharedData->data(), m_size);
}
if (m_data)
{
return gsl::span<ElementType>(m_data, m_size);
}
if (m_gpuData)
{
return gsl::span<ElementType>((ElementType*)m_gpuData, m_size);
}
if (m_stageId.id)
{
auto iStageReaderWriter = carb::getCachedInterface<omni::fabric::IStageReaderWriter>();
size_t size = iStageReaderWriter->getArrayAttributeSize(m_stageId, m_path, m_attr);
auto validBits = iStageReaderWriter->getAttributeValidBits(m_stageId, m_path, m_attr);
if (uint32_t(validBits & omni::fabric::ValidMirrors::eCPU) != 0)
{
auto fabSpan = iStageReaderWriter->getArrayAttribute(m_stageId, m_path, m_attr);
return gsl::span<ElementType>((ElementType*)fabSpan.ptr, size);
}
else if (uint32_t(validBits & omni::fabric::ValidMirrors::eCudaGPU) != 0)
{
auto fabSpan = iStageReaderWriter->getAttributeGpu(m_stageId, m_path, m_attr);
return gsl::span<ElementType>((ElementType*)fabSpan.ptr, size);
}
}
return gsl::span<ElementType>();
}
template <typename ElementType>
inline size_t VtArray<ElementType>::size() const
{
return span().size();
}
template <typename ElementType>
inline size_t VtArray<ElementType>::capacity() const
{
if (!IsOwnData())
{
return span().size();
}
return m_capacity;
}
template <typename ElementType>
inline bool VtArray<ElementType>::empty() const
{
return span().empty();
}
template <typename ElementType>
inline bool VtArray<ElementType>::IsFabricData() const
{
return m_stageId.id != 0;
}
template <typename ElementType>
inline bool VtArray<ElementType>::IsPythonData() const
{
return !m_externalArray.is(py::none());
}
template <typename ElementType>
inline bool VtArray<ElementType>::IsOwnData() const
{
return (bool)m_sharedData;
}
template <typename ElementType>
inline bool VtArray<ElementType>::HasFabricGpuData() const
{
if (m_stageId.id)
{
auto iStageReaderWriter = carb::getCachedInterface<omni::fabric::IStageReaderWriter>();
auto validBits = iStageReaderWriter->getAttributeValidBits(m_stageId, m_path, m_attr);
return uint32_t(validBits & omni::fabric::ValidMirrors::eCudaGPU) != 0;
}
return false;
}
template <typename ElementType>
inline bool VtArray<ElementType>::HasFabricCpuData() const
{
if (m_stageId.id)
{
auto iStageReaderWriter = carb::getCachedInterface<omni::fabric::IStageReaderWriter>();
auto validBits = iStageReaderWriter->getAttributeValidBits(m_stageId, m_path, m_attr);
return uint32_t(validBits & omni::fabric::ValidMirrors::eCPU) != 0;
}
return false;
}
template <typename ElementType>
inline void* VtArray<ElementType>::GetGpuData() const
{
if (m_gpuData)
return m_gpuData;
if (m_stageId.id)
{
auto iStageReaderWriter = carb::getCachedInterface<omni::fabric::IStageReaderWriter>();
auto validBits = iStageReaderWriter->getAttributeValidBits(m_stageId, m_path, m_attr);
if (uint32_t(validBits & omni::fabric::ValidMirrors::eCudaGPU) != 0)
{
auto fabCSpan = iStageReaderWriter->getAttributeRdGpu(m_stageId, m_path, m_attr);
return *(void**)fabCSpan.ptr;
}
}
return nullptr;
}
template <typename ElementType>
inline void VtArray<ElementType>::DetachFromSource()
{
detach();
}
template <typename ElementType>
inline void VtArray<ElementType>::detach()
{
if (m_sharedData && m_sharedData.use_count() == 1)
{
// No need to detach from anything
return;
}
// multiple VtArray have pointers to
// the same underyling data, so localize
// a copy before modifiying
// This mirror's VtArray's COW, CONCA behavior
// https://graphics.pixar.com/usd/release/api/class_vt_array.html#details
localize(span());
}
template <typename ElementType>
template <typename Source>
inline void VtArray<ElementType>::localize(const Source& other)
{
reset();
m_size = other.size();
m_capacity = other.size();
m_sharedData = std::make_shared<gsl::span<ElementType>>(new ElementType[m_size], m_size);
std::copy(other.begin(), other.end(), m_sharedData->begin());
}
template <typename ElementType>
inline void VtArray<ElementType>::resize(size_t newSize)
{
detach();
std::shared_ptr<gsl::span<ElementType>> tmpSpan =
std::make_shared<gsl::span<ElementType>>(new ElementType[newSize], newSize);
if (newSize > m_capacity)
{
std::copy(m_sharedData->begin(), m_sharedData->end(), tmpSpan->begin());
}
else
{
std::copy(m_sharedData->begin(), m_sharedData->begin() + newSize, tmpSpan->begin());
}
delete m_sharedData->data();
m_sharedData = tmpSpan;
m_size = newSize;
m_capacity = newSize;
}
template <typename ElementType>
inline void VtArray<ElementType>::reserve(size_t num)
{
detach();
if (num <= m_capacity)
{
return;
}
std::shared_ptr<gsl::span<ElementType>> tmpSpan = std::make_shared<gsl::span<ElementType>>(new ElementType[num], num);
if (m_size > 0)
{
std::copy(m_sharedData->begin(), m_sharedData->end(), tmpSpan->begin());
delete m_sharedData->data();
}
m_sharedData = tmpSpan;
m_capacity = num;
}
template <typename ElementType>
inline void VtArray<ElementType>::push_back(const ElementType& element)
{
detach();
if (m_size == m_capacity)
{
if (m_size == 0)
{
reserve(2);
}
else
{
reserve(m_size * 2);
}
}
(*m_sharedData)[m_size] = element;
m_size++;
}
} // namespace usdrt
| 15,883 | C | 27.364286 | 122 | 0.659132 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAttribute105.h | // Copyright (c) 2022-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 "Common.h"
#include "IRtAttribute.h"
#include <omni/core/IObject.h>
#include <omni/fabric/AttrNameAndType.h>
#include <omni/fabric/IFabric.h>
#include <vector>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtAttribute105);
class IRtAttribute105_abi : public omni::core::Inherits<usdrt::IRtAttribute, OMNI_TYPE_ID("usdrt.IRtAttribute105")>
{
protected: // all ABI functions must always be 'protected'.
// This should have returned ConstSpanC in the original implementation
// but it's too late now, so fix it here
virtual OMNI_ATTR("not_prop") omni::fabric::ConstSpanC getValueGpuRd_abi() noexcept = 0;
virtual bool isCpuDataValid_abi() noexcept = 0;
virtual bool isGpuDataValid_abi() noexcept = 0;
virtual bool updateCpuDataFromGpu_abi() noexcept = 0;
virtual bool updateGpuDataFromCpu_abi() noexcept = 0;
// Querying and Editing Connections
virtual bool addConnection_abi(const omni::fabric::Connection source, ListPosition position) noexcept = 0;
virtual bool removeConnection_abi(const omni::fabric::Connection source) noexcept = 0;
virtual bool setConnections_abi(OMNI_ATTR("in, count=size") const omni::fabric::Connection* sources,
uint32_t size) noexcept = 0;
virtual bool clearConnections_abi() noexcept = 0;
virtual bool getConnections_abi(OMNI_ATTR("out, count=size") omni::fabric::Connection* sources,
uint32_t size) noexcept = 0;
virtual bool hasAuthoredConnections_abi() noexcept = 0;
virtual uint32_t numConnections_abi() noexcept = 0;
};
} // namespace usdrt
#include "IRtAttribute105.gen.h"
| 2,185 | C | 39.481481 | 115 | 0.729519 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtStage_abi> : public usdrt::IRtStage_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtStage")
omni::core::ObjectPtr<usdrt::IRtStage> open(const char* identifier) noexcept;
omni::core::ObjectPtr<usdrt::IRtStage> createNew(const char* identifier) noexcept;
omni::core::ObjectPtr<usdrt::IRtStage> createInMemory(const char* identifier) noexcept;
omni::core::ObjectPtr<usdrt::IRtStage> attach(omni::fabric::UsdStageId stageId,
omni::fabric::StageReaderWriterId stageReaderWriterId) noexcept;
omni::core::ObjectPtr<usdrt::IRtStage> attachUnknown(omni::fabric::UsdStageId stageId) noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> getDefaultPrim() noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> getPrimAtPath(omni::fabric::PathC path) noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> definePrim(omni::fabric::PathC path, omni::fabric::TokenC typeName) noexcept;
bool removePrim(omni::fabric::PathC path) noexcept;
omni::core::ObjectPtr<usdrt::IRtAttribute> getAttributeAtPath(omni::fabric::PathC path) noexcept;
omni::core::ObjectPtr<usdrt::IRtRelationship> getRelationshipAtPath(omni::fabric::PathC path) noexcept;
void done() noexcept;
omni::fabric::UsdStageId getStageId() noexcept;
void write(const char* filepath) noexcept;
bool hasPrimAtPath(omni::fabric::PathC path) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::core::ObjectPtr<usdrt::IRtStage> omni::core::Generated<usdrt::IRtStage_abi>::open(const char* identifier) noexcept
{
return omni::core::steal(open_abi(identifier));
}
inline omni::core::ObjectPtr<usdrt::IRtStage> omni::core::Generated<usdrt::IRtStage_abi>::createNew(
const char* identifier) noexcept
{
return omni::core::steal(createNew_abi(identifier));
}
inline omni::core::ObjectPtr<usdrt::IRtStage> omni::core::Generated<usdrt::IRtStage_abi>::createInMemory(
const char* identifier) noexcept
{
return omni::core::steal(createInMemory_abi(identifier));
}
inline omni::core::ObjectPtr<usdrt::IRtStage> omni::core::Generated<usdrt::IRtStage_abi>::attach(
omni::fabric::UsdStageId stageId, omni::fabric::StageReaderWriterId stageReaderWriterId) noexcept
{
return omni::core::steal(attach_abi(stageId, stageReaderWriterId));
}
inline omni::core::ObjectPtr<usdrt::IRtStage> omni::core::Generated<usdrt::IRtStage_abi>::attachUnknown(
omni::fabric::UsdStageId stageId) noexcept
{
return omni::core::steal(attachUnknown_abi(stageId));
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtStage_abi>::getDefaultPrim() noexcept
{
return omni::core::steal(getDefaultPrim_abi());
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtStage_abi>::getPrimAtPath(
omni::fabric::PathC path) noexcept
{
return omni::core::steal(getPrimAtPath_abi(path));
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtStage_abi>::definePrim(
omni::fabric::PathC path, omni::fabric::TokenC typeName) noexcept
{
return omni::core::steal(definePrim_abi(path, typeName));
}
inline bool omni::core::Generated<usdrt::IRtStage_abi>::removePrim(omni::fabric::PathC path) noexcept
{
return removePrim_abi(path);
}
inline omni::core::ObjectPtr<usdrt::IRtAttribute> omni::core::Generated<usdrt::IRtStage_abi>::getAttributeAtPath(
omni::fabric::PathC path) noexcept
{
return omni::core::steal(getAttributeAtPath_abi(path));
}
inline omni::core::ObjectPtr<usdrt::IRtRelationship> omni::core::Generated<usdrt::IRtStage_abi>::getRelationshipAtPath(
omni::fabric::PathC path) noexcept
{
return omni::core::steal(getRelationshipAtPath_abi(path));
}
inline void omni::core::Generated<usdrt::IRtStage_abi>::done() noexcept
{
done_abi();
}
inline omni::fabric::UsdStageId omni::core::Generated<usdrt::IRtStage_abi>::getStageId() noexcept
{
return getStageId_abi();
}
inline void omni::core::Generated<usdrt::IRtStage_abi>::write(const char* filepath) noexcept
{
write_abi(filepath);
}
inline bool omni::core::Generated<usdrt::IRtStage_abi>::hasPrimAtPath(omni::fabric::PathC path) noexcept
{
return hasPrimAtPath_abi(path);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 5,183 | C | 29.315789 | 127 | 0.731623 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrimRange.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 "IRtPrim.h"
#include <omni/core/IObject.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtPrimRange);
// OMNI_DECLARE_INTERFACE(IRtPrim);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtPrimRange_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtPrimRange")>
{
protected: // all ABI functions must always be 'protected'.
virtual IRtPrimRange* create_abi(OMNI_ATTR("not_null") IRtPrim* start) noexcept = 0;
virtual IRtPrim* get_abi() noexcept = 0;
virtual bool next_abi() noexcept = 0;
virtual bool done_abi() noexcept = 0;
virtual void pruneChildren_abi() noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtPrimRange.gen.h"
| 3,525 | C | 49.371428 | 120 | 0.420142 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/Common.h | // Copyright (c) 2022-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 <omni/core/IObject.h>
namespace usdrt
{
/// \enum UsdSchemaType
///
/// An enum representing which type of schema a given schema class belongs to
///
enum class UsdSchemaType
{
/// Represents abstract or base schema types that are interface-only
/// and cannot be instantiated. These are reserved for core base classes
/// known to the usdGenSchema system, so this should never be assigned to
/// generated schema classes.
AbstractBase,
/// Represents a non-concrete typed schema
AbstractTyped,
/// Represents a concrete typed schema
ConcreteTyped,
/// Non-applied API schema
NonAppliedAPI,
/// Single Apply API schema
SingleApplyAPI,
/// Multiple Apply API Schema
MultipleApplyAPI
};
enum class OMNI_ATTR("prefix=e") ListPosition : uint32_t
{
eFrontOfPrepend,
eBackOfPrepend,
eFrontOfAppend,
eBackOfAppend
};
}
| 1,355 | C | 26.673469 | 77 | 0.732103 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtObject.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtObject_abi> : public usdrt::IRtObject_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtObject")
bool isValid() noexcept;
omni::fabric::TokenC getName() noexcept;
omni::fabric::PathC getPrimPath() noexcept;
omni::fabric::PathC getPath() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtObject_abi>::isValid() noexcept
{
return isValid_abi();
}
inline omni::fabric::TokenC omni::core::Generated<usdrt::IRtObject_abi>::getName() noexcept
{
return getName_abi();
}
inline omni::fabric::PathC omni::core::Generated<usdrt::IRtObject_abi>::getPrimPath() noexcept
{
return getPrimPath_abi();
}
inline omni::fabric::PathC omni::core::Generated<usdrt::IRtObject_abi>::getPath() noexcept
{
return getPath_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,741 | C | 22.54054 | 94 | 0.724871 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAttribute.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtAttribute_abi> : public usdrt::IRtAttribute_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtAttribute")
bool hasValue() noexcept;
bool hasAuthoredValue() noexcept;
bool hasAuthoredValueGpu() noexcept;
omni::fabric::ConstSpanC getValue() noexcept;
omni::fabric::SpanC getValueGpu() noexcept;
omni::fabric::SpanC setValue() noexcept;
omni::fabric::SpanC setValueGpu() noexcept;
size_t getValueArraySize() noexcept;
void setValueNewArraySize(size_t size) noexcept;
omni::fabric::TypeC getTypeName() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtAttribute_abi>::hasValue() noexcept
{
return hasValue_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute_abi>::hasAuthoredValue() noexcept
{
return hasAuthoredValue_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute_abi>::hasAuthoredValueGpu() noexcept
{
return hasAuthoredValueGpu_abi();
}
inline omni::fabric::ConstSpanC omni::core::Generated<usdrt::IRtAttribute_abi>::getValue() noexcept
{
return getValue_abi();
}
inline omni::fabric::SpanC omni::core::Generated<usdrt::IRtAttribute_abi>::getValueGpu() noexcept
{
return getValueGpu_abi();
}
inline omni::fabric::SpanC omni::core::Generated<usdrt::IRtAttribute_abi>::setValue() noexcept
{
return setValue_abi();
}
inline omni::fabric::SpanC omni::core::Generated<usdrt::IRtAttribute_abi>::setValueGpu() noexcept
{
return setValueGpu_abi();
}
inline size_t omni::core::Generated<usdrt::IRtAttribute_abi>::getValueArraySize() noexcept
{
return getValueArraySize_abi();
}
inline void omni::core::Generated<usdrt::IRtAttribute_abi>::setValueNewArraySize(size_t size) noexcept
{
setValueNewArraySize_abi(size);
}
inline omni::fabric::TypeC omni::core::Generated<usdrt::IRtAttribute_abi>::getTypeName() noexcept
{
return getTypeName_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,864 | C | 22.483606 | 102 | 0.73324 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAssetPath.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 <omni/core/IObject.h>
#include <omni/fabric/IToken.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtAssetPath);
class IRtAssetPath_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtAssetPath")>
{
protected: // all ABI functions must always be 'protected'.
virtual IRtAssetPath* create_abi(OMNI_ATTR("not_null, c_str") const char* assetPath) noexcept = 0;
virtual IRtAssetPath* createWithResolved_abi(OMNI_ATTR("not_null, c_str") const char* assetPath,
OMNI_ATTR("not_null, c_str") const char* resolvedPath) noexcept = 0;
virtual OMNI_ATTR("not_prop") const char* getAssetPath_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") const char* getResolvedPath_abi() noexcept = 0;
// RT-only
virtual IRtAssetPath* createFromFabric_abi(OMNI_ATTR("not_null, in") const void* fabricAssetPath) noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::TokenC getAssetPathC_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::TokenC getResolvedPathC_abi() noexcept = 0;
};
} // namespace usdrt
#include "IRtAssetPath.gen.h"
| 1,675 | C | 40.899999 | 117 | 0.724776 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrimRange.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtPrimRange_abi> : public usdrt::IRtPrimRange_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtPrimRange")
omni::core::ObjectPtr<usdrt::IRtPrimRange> create(omni::core::ObjectParam<usdrt::IRtPrim> start) noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> get() noexcept;
bool next() noexcept;
bool done() noexcept;
void pruneChildren() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::core::ObjectPtr<usdrt::IRtPrimRange> omni::core::Generated<usdrt::IRtPrimRange_abi>::create(
omni::core::ObjectParam<usdrt::IRtPrim> start) noexcept
{
return omni::core::steal(create_abi(start.get()));
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtPrimRange_abi>::get() noexcept
{
return omni::core::steal(get_abi());
}
inline bool omni::core::Generated<usdrt::IRtPrimRange_abi>::next() noexcept
{
return next_abi();
}
inline bool omni::core::Generated<usdrt::IRtPrimRange_abi>::done() noexcept
{
return done_abi();
}
inline void omni::core::Generated<usdrt::IRtPrimRange_abi>::pruneChildren() noexcept
{
pruneChildren_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,063 | C | 23.86747 | 110 | 0.724673 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtProperty.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtProperty_abi> : public usdrt::IRtProperty_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtProperty")
omni::core::ObjectPtr<omni::str::IReadOnlyCString> getBaseName() noexcept;
omni::core::ObjectPtr<omni::str::IReadOnlyCString> getNamespace() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::core::ObjectPtr<omni::str::IReadOnlyCString> omni::core::Generated<usdrt::IRtProperty_abi>::getBaseName() noexcept
{
return omni::core::steal(getBaseName_abi());
}
inline omni::core::ObjectPtr<omni::str::IReadOnlyCString> omni::core::Generated<usdrt::IRtProperty_abi>::getNamespace() noexcept
{
return omni::core::steal(getNamespace_abi());
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,620 | C | 26.948275 | 128 | 0.741358 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAttribute.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 "IRtProperty.h"
#include <omni/core/IObject.h>
#include <omni/fabric/AttrNameAndType.h>
#include <omni/fabric/IFabric.h>
#include <vector>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtAttribute);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtAttribute_abi : public omni::core::Inherits<usdrt::IRtProperty, OMNI_TYPE_ID("usdrt.IRtAttribute")>
{
protected: // all ABI functions must always be 'protected'.
// ---- values
virtual bool hasValue_abi() noexcept = 0;
virtual bool hasAuthoredValue_abi() noexcept = 0;
virtual bool hasAuthoredValueGpu_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::ConstSpanC getValue_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::SpanC getValueGpu_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::SpanC setValue_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::SpanC setValueGpu_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") size_t getValueArraySize_abi() noexcept = 0;
// setValueNewArraySize() should be called before setValue() when
// writing a new array value to fabric
virtual OMNI_ATTR("not_prop") void setValueNewArraySize_abi(size_t size) noexcept = 0;
// ---- metadata
virtual OMNI_ATTR("not_prop") omni::fabric::TypeC getTypeName_abi() noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtAttribute.gen.h"
| 4,228 | C | 48.752941 | 120 | 0.46736 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage105.h | // Copyright (c) 2021-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 "IRtStage.h"
#include <omni/core/IObject.h>
#include <omni/fabric/IFabric.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IToken.h>
#include <usdrt/gf/range.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtStage105);
class IRtStage105_abi : public omni::core::Inherits<IRtStage, OMNI_TYPE_ID("usdrt.IRtStage105")>
{
protected: // all ABI functions must always be 'protected'.
virtual uint32_t findCount_abi(omni::fabric::TokenC typeName,
OMNI_ATTR("in, count=apiNamesSize") const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize) noexcept = 0;
virtual bool find_abi(omni::fabric::TokenC typeName,
OMNI_ATTR("in, count=apiNamesSize") const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
OMNI_ATTR("out, count=outPathCount") omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept = 0;
virtual bool computeWorldBound_abi(OMNI_ATTR("out") GfRange3d* result) noexcept = 0;
// ---- new attr methods to include token
virtual OMNI_ATTR("not_prop") IRtAttribute* getAttributeAtPath105_abi(omni::fabric::PathC path,
omni::fabric::TokenC prop) noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtRelationship* getRelationshipAtPath105_abi(omni::fabric::PathC path,
omni::fabric::TokenC prop) noexcept = 0;
// ---- additional flag on hasPrimAtPath to ignore tags from stage query api
virtual bool hasPrimAtPath105_abi(omni::fabric::PathC path, bool excludeTags) noexcept = 0;
};
} // namespace usdrt
#include "IRtStage105.gen.h"
| 2,349 | C | 44.192307 | 120 | 0.65049 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrim105.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 "IRtAttribute.h"
#include "IRtPrim.h"
#include <omni/core/IObject.h>
#include <omni/fabric/Type.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtPrim105);
class IRtPrim105_abi : public omni::core::Inherits<IRtPrim, OMNI_TYPE_ID("usdrt.IRtPrim105")>
{
protected: // all ABI functions must always be 'protected'.
virtual OMNI_ATTR("not_prop") uint32_t getAttributesWithTypeCount_abi(omni::fabric::TypeC attrType) noexcept = 0;
virtual OMNI_ATTR("not_prop, no_api") bool getAttributesWithType_abi(omni::fabric::TypeC attrType,
OMNI_ATTR("out, count=attrsSize, *not_null")
IRtAttribute** attrs,
uint32_t attrsSize) noexcept = 0;
};
} // namespace usdrt
#include "IRtPrim105.gen.h"
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::IRtPrim105)
{
public:
bool getAttributesWithType(omni::fabric::TypeC attrType, usdrt::IRtAttribute** attrs, uint32_t attrsSize) noexcept
{
if (attrsSize == 0)
{
return false;
}
return getAttributesWithType_abi(attrType, attrs, attrsSize);
}
};
// clang-format on
| 1,825 | C | 32.199999 | 118 | 0.644384 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage104QuerySupport.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtStage104QuerySupport_abi> : public usdrt::IRtStage104QuerySupport_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtStage104QuerySupport")
uint32_t findCount(omni::fabric::TokenC typeName, const omni::fabric::TokenC* apiNames, uint32_t apiNamesSize) noexcept;
bool find(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept;
bool computeWorldBound(usdrt::GfRange3d* result) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline uint32_t omni::core::Generated<usdrt::IRtStage104QuerySupport_abi>::findCount(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize) noexcept
{
return findCount_abi(typeName, apiNames, apiNamesSize);
}
inline bool omni::core::Generated<usdrt::IRtStage104QuerySupport_abi>::find(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept
{
return find_abi(typeName, apiNames, apiNamesSize, outPaths, outPathCount);
}
inline bool omni::core::Generated<usdrt::IRtStage104QuerySupport_abi>::computeWorldBound(usdrt::GfRange3d* result) noexcept
{
return computeWorldBound_abi(result);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,753 | C | 35.236842 | 124 | 0.615692 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtRelationship.gen.h | // Copyright (c) 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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtRelationship_abi> : public usdrt::IRtRelationship_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtRelationship")
bool hasAuthoredTargets() noexcept;
bool addTarget(omni::fabric::PathC path, usdrt::ListPosition position) noexcept;
bool removeTarget(omni::fabric::PathC path) noexcept;
bool setTargets(const omni::fabric::PathC* paths, uint32_t size) noexcept;
bool clearTargets() noexcept;
uint32_t numTargets() noexcept;
bool getTargets(omni::fabric::PathC* paths, uint32_t size) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::hasAuthoredTargets() noexcept
{
return hasAuthoredTargets_abi();
}
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::addTarget(omni::fabric::PathC path,
usdrt::ListPosition position) noexcept
{
return addTarget_abi(path, position);
}
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::removeTarget(omni::fabric::PathC path) noexcept
{
return removeTarget_abi(path);
}
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::setTargets(const omni::fabric::PathC* paths,
uint32_t size) noexcept
{
return setTargets_abi(paths, size);
}
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::clearTargets() noexcept
{
return clearTargets_abi();
}
inline uint32_t omni::core::Generated<usdrt::IRtRelationship_abi>::numTargets() noexcept
{
return numTargets_abi();
}
inline bool omni::core::Generated<usdrt::IRtRelationship_abi>::getTargets(omni::fabric::PathC* paths, uint32_t size) noexcept
{
return getTargets_abi(paths, size);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,729 | C | 26.3 | 125 | 0.702089 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtProperty.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 "IRtObject.h"
#include <omni/core/IObject.h>
#include <omni/extras/OutArrayUtils.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IToken.h>
#include <omni/str/IReadOnlyCString.h>
#include <vector>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtProperty);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtProperty_abi : public omni::core::Inherits<usdrt::IRtObject, OMNI_TYPE_ID("usdrt.IRtPropety")>
{
protected: // all ABI functions must always be 'protected'.
// ---- property name
virtual OMNI_ATTR("not_prop") omni::str::IReadOnlyCString* getBaseName_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::str::IReadOnlyCString* getNamespace_abi() noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result
splitName_abi(OMNI_ATTR("out, count=*partsCount, *not_null") omni::str::IReadOnlyCString** parts,
OMNI_ATTR("out, not_null") uint32_t* partsCount) noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtProperty.gen.h"
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::IRtProperty) {
public:
std::vector<std::string> splitName() noexcept
{
std::vector<omni::core::ObjectPtr<omni::str::IReadOnlyCString>> vec;
auto result = omni::extras::getOutArray<omni::str::IReadOnlyCString*>(
[this](omni::str::IReadOnlyCString** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(omni::str::IReadOnlyCString*) * *outCount);
// incoming ptrs must be nullptr
return this->splitName_abi(out, outCount);
},
[&vec](omni::str::IReadOnlyCString** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
}
);
std::vector<std::string> out;
out.reserve(vec.size());
for (const auto& roc : vec)
{
out.push_back(std::string(roc->getBuffer()));
}
return out;
}
};
// clang-format on
| 4,985 | C | 43.517857 | 120 | 0.45677 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAttribute105.gen.h | // Copyright (c) 2022-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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtAttribute105_abi> : public usdrt::IRtAttribute105_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtAttribute105")
omni::fabric::ConstSpanC getValueGpuRd() noexcept;
bool isCpuDataValid() noexcept;
bool isGpuDataValid() noexcept;
bool updateCpuDataFromGpu() noexcept;
bool updateGpuDataFromCpu() noexcept;
bool addConnection(omni::fabric::Connection source, usdrt::ListPosition position) noexcept;
bool removeConnection(omni::fabric::Connection source) noexcept;
bool setConnections(const omni::fabric::Connection* sources, uint32_t size) noexcept;
bool clearConnections() noexcept;
bool getConnections(omni::fabric::Connection* sources, uint32_t size) noexcept;
bool hasAuthoredConnections() noexcept;
uint32_t numConnections() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::fabric::ConstSpanC omni::core::Generated<usdrt::IRtAttribute105_abi>::getValueGpuRd() noexcept
{
return getValueGpuRd_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::isCpuDataValid() noexcept
{
return isCpuDataValid_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::isGpuDataValid() noexcept
{
return isGpuDataValid_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::updateCpuDataFromGpu() noexcept
{
return updateCpuDataFromGpu_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::updateGpuDataFromCpu() noexcept
{
return updateGpuDataFromCpu_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::addConnection(omni::fabric::Connection source,
usdrt::ListPosition position) noexcept
{
return addConnection_abi(source, position);
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::removeConnection(omni::fabric::Connection source) noexcept
{
return removeConnection_abi(source);
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::setConnections(const omni::fabric::Connection* sources,
uint32_t size) noexcept
{
return setConnections_abi(sources, size);
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::clearConnections() noexcept
{
return clearConnections_abi();
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::getConnections(omni::fabric::Connection* sources,
uint32_t size) noexcept
{
return getConnections_abi(sources, size);
}
inline bool omni::core::Generated<usdrt::IRtAttribute105_abi>::hasAuthoredConnections() noexcept
{
return hasAuthoredConnections_abi();
}
inline uint32_t omni::core::Generated<usdrt::IRtAttribute105_abi>::numConnections() noexcept
{
return numConnections_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 3,866 | C | 26.425532 | 121 | 0.708226 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtObject.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 <omni/core/IObject.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IToken.h>
#include <vector>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtObject);
OMNI_DECLARE_INTERFACE(IRtPrim);
OMNI_DECLARE_INTERFACE(IRtStage);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtObject_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtObject")>
{
protected: // all ABI functions must always be 'protected'.
// ---- validity
virtual bool isValid_abi() noexcept = 0;
// ---- context
virtual OMNI_ATTR("not_prop, no_api") IRtPrim* getPrim_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop, no_api") IRtStage* getStage_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::TokenC getName_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::PathC getPrimPath_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::PathC getPath_abi() noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtObject.gen.h"
// FIXME omni.bind doesn't generate ObjectPtr correctly with forward declarations,
// as far as I can tell, or I'm missing something important
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::IRtObject) {
public:
omni::core::ObjectPtr<usdrt::IRtPrim> getPrim() noexcept {
return omni::core::steal(getPrim_abi());
}
omni::core::ObjectPtr<usdrt::IRtStage> getStage() noexcept
{
return omni::core::steal(getStage_abi());
}
};
// clang-format on
| 4,320 | C | 44.010416 | 120 | 0.466435 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtSchemaRegistry.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtSchemaRegistry_abi> : public usdrt::IRtSchemaRegistry_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtSchemaRegistry")
omni::core::ObjectPtr<usdrt::IRtSchemaRegistry> initRegistry() noexcept;
bool isConcrete(omni::fabric::TokenC primTypeC) noexcept;
bool isAppliedAPISchema(omni::fabric::TokenC apiSchemaTypeC) noexcept;
bool isMultipleApplyAPISchema(omni::fabric::TokenC apiSchemaTypeC) noexcept;
bool isA(omni::fabric::TokenC sourceTypeNameC, omni::fabric::TokenC queryTypeNameC) noexcept;
omni::fabric::TokenC getAliasFromName(omni::fabric::TokenC nameC) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::core::ObjectPtr<usdrt::IRtSchemaRegistry> omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::initRegistry() noexcept
{
return omni::core::steal(initRegistry_abi());
}
inline bool omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::isConcrete(omni::fabric::TokenC primTypeC) noexcept
{
return isConcrete_abi(primTypeC);
}
inline bool omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::isAppliedAPISchema(omni::fabric::TokenC apiSchemaTypeC) noexcept
{
return isAppliedAPISchema_abi(apiSchemaTypeC);
}
inline bool omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::isMultipleApplyAPISchema(
omni::fabric::TokenC apiSchemaTypeC) noexcept
{
return isMultipleApplyAPISchema_abi(apiSchemaTypeC);
}
inline bool omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::isA(omni::fabric::TokenC sourceTypeNameC,
omni::fabric::TokenC queryTypeNameC) noexcept
{
return isA_abi(sourceTypeNameC, queryTypeNameC);
}
inline omni::fabric::TokenC omni::core::Generated<usdrt::IRtSchemaRegistry_abi>::getAliasFromName(
omni::fabric::TokenC nameC) noexcept
{
return getAliasFromName_abi(nameC);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,790 | C | 29.010752 | 131 | 0.743011 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage.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 "IRtAttribute.h"
#include "IRtPrim.h"
#include "IRtRelationship.h"
#include <omni/core/IObject.h>
#include <omni/fabric/IFabric.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IToken.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtStage);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtStage_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtStage")>
{
protected: // all ABI functions must always be 'protected'.
// ---- static methods
virtual IRtStage* open_abi(OMNI_ATTR("c_str, in, not_null") const char* identifier) noexcept = 0;
virtual IRtStage* createNew_abi(OMNI_ATTR("c_str, in, not_null") const char* identifier) noexcept = 0;
virtual IRtStage* createInMemory_abi(OMNI_ATTR("c_str, in, not_null") const char* identifier) noexcept = 0;
virtual IRtStage* attach_abi(omni::fabric::UsdStageId stageId,
omni::fabric::StageReaderWriterId stageReaderWriterId) noexcept = 0;
virtual IRtStage* attachUnknown_abi(omni::fabric::UsdStageId stageId) noexcept = 0;
// ---- prim methods
virtual OMNI_ATTR("not_prop") IRtPrim* getDefaultPrim_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtPrim* getPrimAtPath_abi(omni::fabric::PathC path) noexcept = 0;
virtual IRtPrim* definePrim_abi(omni::fabric::PathC path, omni::fabric::TokenC typeName) noexcept = 0;
virtual bool removePrim_abi(omni::fabric::PathC path) noexcept = 0;
// ---- attr methods
virtual OMNI_ATTR("not_prop") IRtAttribute* getAttributeAtPath_abi(omni::fabric::PathC path) noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtRelationship* getRelationshipAtPath_abi(omni::fabric::PathC path) noexcept = 0;
// ---- rt methods
virtual void done_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::UsdStageId getStageId_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop, no_api") omni::fabric::StageReaderWriterId getStageInProgressId_abi() noexcept = 0;
virtual void write_abi(OMNI_ATTR("c_str, in") const char* filepath) noexcept = 0;
virtual bool hasPrimAtPath_abi(omni::fabric::PathC path) noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtStage.gen.h"
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::IRtStage)
{
public:
omni::fabric::StageReaderWriterId getStageReaderWriterId()
{
return getStageInProgressId_abi();
}
};
// clang-format on
| 5,247 | C | 48.980952 | 120 | 0.512483 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtAssetPath.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtAssetPath_abi> : public usdrt::IRtAssetPath_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtAssetPath")
omni::core::ObjectPtr<usdrt::IRtAssetPath> create(const char* assetPath) noexcept;
omni::core::ObjectPtr<usdrt::IRtAssetPath> createWithResolved(const char* assetPath,
const char* resolvedPath) noexcept;
const char* getAssetPath() noexcept;
const char* getResolvedPath() noexcept;
omni::core::ObjectPtr<usdrt::IRtAssetPath> createFromFabric(const void* fabricAssetPath) noexcept;
omni::fabric::TokenC getAssetPathC() noexcept;
omni::fabric::TokenC getResolvedPathC() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline omni::core::ObjectPtr<usdrt::IRtAssetPath> omni::core::Generated<usdrt::IRtAssetPath_abi>::create(
const char* assetPath) noexcept
{
return omni::core::steal(create_abi(assetPath));
}
inline omni::core::ObjectPtr<usdrt::IRtAssetPath> omni::core::Generated<usdrt::IRtAssetPath_abi>::createWithResolved(
const char* assetPath, const char* resolvedPath) noexcept
{
return omni::core::steal(createWithResolved_abi(assetPath, resolvedPath));
}
inline const char* omni::core::Generated<usdrt::IRtAssetPath_abi>::getAssetPath() noexcept
{
return getAssetPath_abi();
}
inline const char* omni::core::Generated<usdrt::IRtAssetPath_abi>::getResolvedPath() noexcept
{
return getResolvedPath_abi();
}
inline omni::core::ObjectPtr<usdrt::IRtAssetPath> omni::core::Generated<usdrt::IRtAssetPath_abi>::createFromFabric(
const void* fabricAssetPath) noexcept
{
return omni::core::steal(createFromFabric_abi(fabricAssetPath));
}
inline omni::fabric::TokenC omni::core::Generated<usdrt::IRtAssetPath_abi>::getAssetPathC() noexcept
{
return getAssetPathC_abi();
}
inline omni::fabric::TokenC omni::core::Generated<usdrt::IRtAssetPath_abi>::getResolvedPathC() noexcept
{
return getResolvedPathC_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,912 | C | 27.558823 | 117 | 0.729739 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage104QuerySupport.h | // Copyright (c) 2021-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 <omni/core/IObject.h>
#include <omni/fabric/IFabric.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IToken.h>
#include <usdrt/gf/range.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtStage104QuerySupport);
class IRtStage104QuerySupport_abi
: public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtStage104QuerySupport")>
{
protected: // all ABI functions must always be 'protected'.
virtual uint32_t findCount_abi(omni::fabric::TokenC typeName,
OMNI_ATTR("in, count=apiNamesSize") const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize) noexcept = 0;
virtual bool find_abi(omni::fabric::TokenC typeName,
OMNI_ATTR("in, count=apiNamesSize") const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
OMNI_ATTR("out, count=outPathCount") omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept = 0;
virtual bool computeWorldBound_abi(OMNI_ATTR("out") GfRange3d* result) noexcept = 0;
};
} // namespace usdrt
#include "IRtStage104QuerySupport.gen.h"
| 1,722 | C | 40.023809 | 108 | 0.691057 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtBoundable.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 "IRtPrim.h"
#include <omni/core/IObject.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtBoundable);
class IRtBoundable_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtBoundable")>
{
protected: // all ABI functions must always be 'protected'.
virtual OMNI_ATTR("not_prop") bool setWorldExtentFromUsd_abi(OMNI_ATTR("not_null") IRtPrim* prim) noexcept = 0;
};
} // namespace usdrt
#include "IRtBoundable.gen.h"
| 985 | C | 29.812499 | 115 | 0.765482 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrim.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtPrim_abi> : public usdrt::IRtPrim_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtPrim")
bool hasAttribute(omni::fabric::TokenC attrName) noexcept;
omni::core::ObjectPtr<usdrt::IRtAttribute> getAttribute(omni::fabric::TokenC attrName) noexcept;
omni::core::ObjectPtr<usdrt::IRtAttribute> createAttribute(omni::fabric::TokenC name,
omni::fabric::TypeC typeName,
bool custom,
usdrt::Variability varying) noexcept;
bool hasRelationship(omni::fabric::TokenC relName) noexcept;
omni::core::ObjectPtr<usdrt::IRtRelationship> getRelationship(omni::fabric::TokenC relName) noexcept;
omni::core::ObjectPtr<usdrt::IRtRelationship> createRelationship(omni::fabric::TokenC relName, bool custom) noexcept;
bool removeProperty(omni::fabric::TokenC propName) noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> getChild(omni::fabric::TokenC name) noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> getParent() noexcept;
omni::core::ObjectPtr<usdrt::IRtPrim> getNextSibling() noexcept;
omni::fabric::TokenC getTypeName() noexcept;
bool setTypeName(omni::fabric::TokenC typeName) noexcept;
bool hasAuthoredTypeName() noexcept;
bool clearTypeName() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::hasAttribute(omni::fabric::TokenC attrName) noexcept
{
return hasAttribute_abi(attrName);
}
inline omni::core::ObjectPtr<usdrt::IRtAttribute> omni::core::Generated<usdrt::IRtPrim_abi>::getAttribute(
omni::fabric::TokenC attrName) noexcept
{
return omni::core::steal(getAttribute_abi(attrName));
}
inline omni::core::ObjectPtr<usdrt::IRtAttribute> omni::core::Generated<usdrt::IRtPrim_abi>::createAttribute(
omni::fabric::TokenC name, omni::fabric::TypeC typeName, bool custom, usdrt::Variability varying) noexcept
{
return omni::core::steal(createAttribute_abi(name, typeName, custom, varying));
}
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::hasRelationship(omni::fabric::TokenC relName) noexcept
{
return hasRelationship_abi(relName);
}
inline omni::core::ObjectPtr<usdrt::IRtRelationship> omni::core::Generated<usdrt::IRtPrim_abi>::getRelationship(
omni::fabric::TokenC relName) noexcept
{
return omni::core::steal(getRelationship_abi(relName));
}
inline omni::core::ObjectPtr<usdrt::IRtRelationship> omni::core::Generated<usdrt::IRtPrim_abi>::createRelationship(
omni::fabric::TokenC relName, bool custom) noexcept
{
return omni::core::steal(createRelationship_abi(relName, custom));
}
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::removeProperty(omni::fabric::TokenC propName) noexcept
{
return removeProperty_abi(propName);
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtPrim_abi>::getChild(
omni::fabric::TokenC name) noexcept
{
return omni::core::steal(getChild_abi(name));
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtPrim_abi>::getParent() noexcept
{
return omni::core::steal(getParent_abi());
}
inline omni::core::ObjectPtr<usdrt::IRtPrim> omni::core::Generated<usdrt::IRtPrim_abi>::getNextSibling() noexcept
{
return omni::core::steal(getNextSibling_abi());
}
inline omni::fabric::TokenC omni::core::Generated<usdrt::IRtPrim_abi>::getTypeName() noexcept
{
return getTypeName_abi();
}
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::setTypeName(omni::fabric::TokenC typeName) noexcept
{
return setTypeName_abi(typeName);
}
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::hasAuthoredTypeName() noexcept
{
return hasAuthoredTypeName_abi();
}
inline bool omni::core::Generated<usdrt::IRtPrim_abi>::clearTypeName() noexcept
{
return clearTypeName_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 4,904 | C | 29.277778 | 121 | 0.713499 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtXformable.h | // Copyright (c) 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 "IRtPrim.h"
#include <omni/core/IObject.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtXformable);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtXformable_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtXformable")>
{
protected: // all ABI functions must always be 'protected'.
virtual OMNI_ATTR("not_prop") bool setWorldXformFromUsd_abi(OMNI_ATTR("not_null") IRtPrim* prim) noexcept = 0;
virtual OMNI_ATTR("not_prop") bool setLocalXformFromUsd_abi(OMNI_ATTR("not_null") IRtPrim* prim) noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtXformable.gen.h"
| 3,445 | C | 51.21212 | 120 | 0.416546 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtBoundable.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtBoundable_abi> : public usdrt::IRtBoundable_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtBoundable")
bool setWorldExtentFromUsd(omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtBoundable_abi>::setWorldExtentFromUsd(
omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept
{
return setWorldExtentFromUsd_abi(prim.get());
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,375 | C | 25.980392 | 86 | 0.746909 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrim105.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtPrim105_abi> : public usdrt::IRtPrim105_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtPrim105")
uint32_t getAttributesWithTypeCount(omni::fabric::TypeC attrType) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline uint32_t omni::core::Generated<usdrt::IRtPrim105_abi>::getAttributesWithTypeCount(omni::fabric::TypeC attrType) noexcept
{
return getAttributesWithTypeCount_abi(attrType);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,351 | C | 26.039999 | 127 | 0.752776 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtPrim.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 "IRtAttribute.h"
#include "IRtObject.h"
#include "IRtRelationship.h"
#include <omni/core/IObject.h>
#include <omni/extras/OutArrayUtils.h>
#include <omni/fabric/IToken.h>
#include <omni/str/IReadOnlyCString.h>
#include <vector>
namespace usdrt
{
enum class OMNI_ATTR("prefix=e") Variability : uint32_t
{
eVarying,
eUniform
};
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtPrim);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtPrim_abi : public omni::core::Inherits<usdrt::IRtObject, OMNI_TYPE_ID("usdrt.IRtPrim")>
{
protected: // all ABI functions must always be 'protected'.
// ---- attributes
virtual bool hasAttribute_abi(omni::fabric::TokenC attrName) noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtAttribute* getAttribute_abi(omni::fabric::TokenC attrName) noexcept = 0;
virtual IRtAttribute* createAttribute_abi(omni::fabric::TokenC name,
omni::fabric::TypeC typeName,
bool custom,
Variability varying) noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result getAttributes_abi( // disable omni.bind until OM-21202
OMNI_ATTR("out, count=*outCount, *not_null") IRtAttribute** out,
OMNI_ATTR("out, not_null") uint32_t* outCount) noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result getAuthoredAttributes_abi( // disable omni.bind until OM-21202
OMNI_ATTR("out, count=*outCount, *not_null") IRtAttribute** out,
OMNI_ATTR("out, not_null") uint32_t* outCount) noexcept = 0;
// ---- relationships
virtual bool hasRelationship_abi(omni::fabric::TokenC relName) noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtRelationship* getRelationship_abi(omni::fabric::TokenC relName) noexcept = 0;
virtual IRtRelationship* createRelationship_abi(omni::fabric::TokenC relName, bool custom) noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result getRelationships_abi( // disable omni.bind until OM-21202
OMNI_ATTR("out, count=*outCount, *not_null") IRtRelationship** out,
OMNI_ATTR("out, not_null") uint32_t* outCount) noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result getAuthoredRelationships_abi( // disable omni.bind until OM-21202
OMNI_ATTR("out, count=*outCount, *not_null") IRtRelationship** out,
OMNI_ATTR("out, not_null") uint32_t* outCount) noexcept = 0;
// ---- properties
virtual bool removeProperty_abi(omni::fabric::TokenC propName) noexcept = 0;
// ---- hierarchy
virtual OMNI_ATTR("not_prop") IRtPrim* getChild_abi(omni::fabric::TokenC name) noexcept = 0;
virtual OMNI_ATTR("no_api") omni::core::Result getChildren_abi( // disable omni.bind until OM-21202
OMNI_ATTR("out, count=*outCount, *not_null") IRtPrim** out,
OMNI_ATTR("out, not_null") uint32_t* outCount) noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtPrim* getParent_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") IRtPrim* getNextSibling_abi() noexcept = 0;
// ---- types
virtual OMNI_ATTR("not_prop") omni::fabric::TokenC getTypeName_abi() noexcept = 0;
virtual OMNI_ATTR("not_prop") bool setTypeName_abi(omni::fabric::TokenC typeName) noexcept = 0;
virtual bool hasAuthoredTypeName_abi() noexcept = 0;
virtual bool clearTypeName_abi() noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtPrim.gen.h"
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::IRtPrim)
{
public:
std::vector<omni::core::ObjectPtr<usdrt::IRtAttribute>> getAttributes() noexcept
{
std::vector<omni::core::ObjectPtr<usdrt::IRtAttribute>> vec;
auto result = omni::extras::getOutArray<usdrt::IRtAttribute*>(
[this](usdrt::IRtAttribute** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(usdrt::IRtAttribute*) * *outCount); // incoming ptrs must be nullptr
return this->getAttributes_abi(out, outCount);
},
[&vec](usdrt::IRtAttribute** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
}
);
return vec;
}
std::vector<omni::core::ObjectPtr<usdrt::IRtAttribute>> getAuthoredAttributes() noexcept
{
std::vector<omni::core::ObjectPtr<usdrt::IRtAttribute>> vec;
auto result = omni::extras::getOutArray<usdrt::IRtAttribute*>(
[this](usdrt::IRtAttribute** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(usdrt::IRtAttribute*) * *outCount); // incoming ptrs must be nullptr
return this->getAuthoredAttributes_abi(out, outCount);
},
[&vec](usdrt::IRtAttribute** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
});
return vec;
}
std::vector<omni::core::ObjectPtr<usdrt::IRtRelationship>> getRelationships() noexcept
{
std::vector<omni::core::ObjectPtr<usdrt::IRtRelationship>> vec;
auto result = omni::extras::getOutArray<usdrt::IRtRelationship*>(
[this](usdrt::IRtRelationship** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(usdrt::IRtRelationship*) * *outCount); // incoming ptrs must be nullptr
return this->getRelationships_abi(out, outCount);
},
[&vec](usdrt::IRtRelationship** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
}
);
return vec;
}
std::vector<omni::core::ObjectPtr<usdrt::IRtRelationship>> getAuthoredRelationships() noexcept
{
std::vector<omni::core::ObjectPtr<usdrt::IRtRelationship>> vec;
auto result = omni::extras::getOutArray<usdrt::IRtRelationship*>(
[this](usdrt::IRtRelationship** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(usdrt::IRtRelationship*) * *outCount); // incoming ptrs must be nullptr
return this->getAuthoredRelationships_abi(out, outCount);
},
[&vec](usdrt::IRtRelationship** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
});
return vec;
}
std::vector<omni::core::ObjectPtr<usdrt::IRtPrim>> getChildren() noexcept
{
std::vector<omni::core::ObjectPtr<usdrt::IRtPrim>> vec;
auto result = omni::extras::getOutArray<usdrt::IRtPrim*>(
[this](usdrt::IRtPrim** out, uint32_t* outCount) // get func
{
std::memset(out, 0, sizeof(usdrt::IRtPrim*) * *outCount); // incoming ptrs must be nullptr
return this->getChildren_abi(out, outCount);
},
[&vec](usdrt::IRtPrim** in, uint32_t inCount) // fill func
{
vec.reserve(inCount);
for (uint32_t i = 0; i < inCount; ++i)
{
vec.emplace_back(in[i], omni::core::kSteal);
}
}
);
return vec;
}
};
// clang-format on
| 10,498 | C | 43.867521 | 120 | 0.529244 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtRelationship.h | // Copyright (c) 2022-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 "Common.h"
#include "IRtProperty.h"
#include <omni/core/IObject.h>
#include <omni/fabric/AttrNameAndType.h>
#include <omni/fabric/IFabric.h>
#include <vector>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtRelationship);
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// The interfaces within these obnoxious comment blocks are now locked for long-term support.
// Any changes you wish to make should be added in a new interface.
// See this document for more details:
// https://docs.google.com/document/d/1xyONwFtiM-lWXP5HjQt6pkOgl7xF_4b_Jp4wUS3_d3I/edit?usp=sharing
//
// Please do not break our precious ABIs!
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
class IRtRelationship_abi : public omni::core::Inherits<usdrt::IRtProperty, OMNI_TYPE_ID("usdrt.IRtRelationship")>
{
protected: // all ABI functions must always be 'protected'.
// ---- targets
virtual bool hasAuthoredTargets_abi() noexcept = 0;
// Note: As of this implementation, Fabric does not support
// lists of targets for relationships, so the behavior of some
// of these may diverge from USD until that support is added
virtual bool addTarget_abi(omni::fabric::PathC path, ListPosition position) noexcept = 0;
virtual bool removeTarget_abi(omni::fabric::PathC path) noexcept = 0;
virtual bool OMNI_ATTR("not_prop")
setTargets_abi(OMNI_ATTR("in, count=size") const omni::fabric::PathC* paths, uint32_t size) noexcept = 0;
virtual bool clearTargets_abi() noexcept = 0;
virtual uint32_t numTargets_abi() noexcept = 0;
virtual bool OMNI_ATTR("not_prop")
getTargets_abi(OMNI_ATTR("out, count=size") omni::fabric::PathC* paths, uint32_t size) noexcept = 0;
};
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// End of locked interfaces. Enjoy the rest of your day.
//
// ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
//
// *********************************************************************************************************************
// *********************************************************************************************************************
// *********************************************************************************************************************
} // namespace usdrt
#include "IRtRelationship.gen.h"
| 4,191 | C | 50.121951 | 120 | 0.467907 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtSchemaRegistry.h | // Copyright (c) 2022-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 "Common.h"
#include <omni/fabric/IToken.h>
namespace usdrt
{
// we must always forward declare each interface that will be referenced here.
OMNI_DECLARE_INTERFACE(IRtSchemaRegistry);
class IRtSchemaRegistry_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.IRtSchemaRegistry")>
{
protected: // all ABI functions must always be 'protected'.
virtual IRtSchemaRegistry* initRegistry_abi() noexcept = 0;
virtual bool isConcrete_abi(omni::fabric::TokenC primTypeC) noexcept = 0;
virtual bool isAppliedAPISchema_abi(omni::fabric::TokenC apiSchemaTypeC) noexcept = 0;
virtual bool isMultipleApplyAPISchema_abi(omni::fabric::TokenC apiSchemaTypeC) noexcept = 0;
virtual bool isA_abi(omni::fabric::TokenC sourceTypeNameC, omni::fabric::TokenC queryTypeNameC) noexcept = 0;
virtual OMNI_ATTR("not_prop") omni::fabric::TokenC getAliasFromName_abi(omni::fabric::TokenC nameC) noexcept = 0;
};
} // namespace usdrt
#include "IRtSchemaRegistry.gen.h"
| 1,455 | C | 39.444443 | 119 | 0.770447 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtStage105.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtStage105_abi> : public usdrt::IRtStage105_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtStage105")
uint32_t findCount(omni::fabric::TokenC typeName, const omni::fabric::TokenC* apiNames, uint32_t apiNamesSize) noexcept;
bool find(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept;
bool computeWorldBound(usdrt::GfRange3d* result) noexcept;
omni::core::ObjectPtr<usdrt::IRtAttribute> getAttributeAtPath105(omni::fabric::PathC path,
omni::fabric::TokenC prop) noexcept;
omni::core::ObjectPtr<usdrt::IRtRelationship> getRelationshipAtPath105(omni::fabric::PathC path,
omni::fabric::TokenC prop) noexcept;
bool hasPrimAtPath105(omni::fabric::PathC path, bool excludeTags) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline uint32_t omni::core::Generated<usdrt::IRtStage105_abi>::findCount(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize) noexcept
{
return findCount_abi(typeName, apiNames, apiNamesSize);
}
inline bool omni::core::Generated<usdrt::IRtStage105_abi>::find(omni::fabric::TokenC typeName,
const omni::fabric::TokenC* apiNames,
uint32_t apiNamesSize,
omni::fabric::PathC* outPaths,
uint32_t outPathCount) noexcept
{
return find_abi(typeName, apiNames, apiNamesSize, outPaths, outPathCount);
}
inline bool omni::core::Generated<usdrt::IRtStage105_abi>::computeWorldBound(usdrt::GfRange3d* result) noexcept
{
return computeWorldBound_abi(result);
}
inline omni::core::ObjectPtr<usdrt::IRtAttribute> omni::core::Generated<usdrt::IRtStage105_abi>::getAttributeAtPath105(
omni::fabric::PathC path, omni::fabric::TokenC prop) noexcept
{
return omni::core::steal(getAttributeAtPath105_abi(path, prop));
}
inline omni::core::ObjectPtr<usdrt::IRtRelationship> omni::core::Generated<usdrt::IRtStage105_abi>::getRelationshipAtPath105(
omni::fabric::PathC path, omni::fabric::TokenC prop) noexcept
{
return omni::core::steal(getRelationshipAtPath105_abi(path, prop));
}
inline bool omni::core::Generated<usdrt::IRtStage105_abi>::hasPrimAtPath105(omni::fabric::PathC path,
bool excludeTags) noexcept
{
return hasPrimAtPath105_abi(path, excludeTags);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 3,900 | C | 36.152381 | 125 | 0.625128 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/scenegraph/interface/IRtXformable.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::IRtXformable_abi> : public usdrt::IRtXformable_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::IRtXformable")
bool setWorldXformFromUsd(omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept;
bool setLocalXformFromUsd(omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::IRtXformable_abi>::setWorldXformFromUsd(
omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept
{
return setWorldXformFromUsd_abi(prim.get());
}
inline bool omni::core::Generated<usdrt::IRtXformable_abi>::setLocalXformFromUsd(
omni::core::ObjectParam<usdrt::IRtPrim> prim) noexcept
{
return setLocalXformFromUsd_abi(prim.get());
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,660 | C | 26.683333 | 85 | 0.74759 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/xformcache/ISharedXformCache.gen.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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::xformcache::ISharedXformCache_abi> : public usdrt::xformcache::ISharedXformCache_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::xformcache::ISharedXformCache")
bool hasCache(omni::fabric::UsdStageId stageId) noexcept;
bool clear() noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::xformcache::ISharedXformCache_abi>::hasCache(omni::fabric::UsdStageId stageId) noexcept
{
return hasCache_abi(stageId);
}
inline bool omni::core::Generated<usdrt::xformcache::ISharedXformCache_abi>::clear() noexcept
{
return clear_abi();
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 1,524 | C | 25.293103 | 128 | 0.746719 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/xformcache/IXformCache.h | // Copyright (c) 2022-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 <omni/core/IObject.h>
#include <omni/fabric/IFabric.h>
#include <omni/fabric/IPath.h>
#include <omni/fabric/IdTypes.h>
#include <usdrt/gf/matrix.h>
namespace usdrt
{
namespace xformcache
{
OMNI_DECLARE_INTERFACE(IXformCache);
class IXformCache_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.xformcache.IXformCache")>
{
protected:
virtual bool attachToStage_abi(const omni::fabric::UsdStageId stageId) noexcept = 0;
virtual omni::fabric::UsdStageId getStageId_abi() noexcept = 0;
virtual void syncXforms_abi() noexcept = 0;
virtual void syncTargetedXforms_abi(const omni::fabric::PathC targetPath) noexcept = 0;
virtual OMNI_ATTR("not_prop") usdrt::GfMatrix4d getLatestWorldXform_abi(const omni::fabric::PathC path) noexcept = 0;
virtual usdrt::GfMatrix4d computeWorldXform_abi(const omni::fabric::PathC path) noexcept = 0;
};
} // namespace xformcache
} // namespace usdrt
#include "IXformCache.gen.h"
| 1,426 | C | 31.431817 | 121 | 0.76087 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/xformcache/ISharedXformCache.h | // Copyright (c) 2022-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 "IXformCache.h"
namespace usdrt
{
namespace xformcache
{
OMNI_DECLARE_INTERFACE(ISharedXformCache);
class ISharedXformCache_abi
: public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("usdrt.xformcache.ISharedXformCache")>
{
protected:
virtual bool hasCache_abi(const omni::fabric::UsdStageId stageId) noexcept = 0;
virtual OMNI_ATTR("no_api") IXformCache* getCache_abi(const omni::fabric::UsdStageId stageId) noexcept = 0;
virtual OMNI_ATTR("no_api") IXformCache* getOrCreateCache_abi(const omni::fabric::UsdStageId stageId) noexcept = 0;
virtual bool clear_abi() noexcept = 0;
};
} // namespace xformcache
} // namespace usdrt
#include "ISharedXformCache.gen.h"
// clang-format off
OMNI_DEFINE_INTERFACE_API(usdrt::xformcache::ISharedXformCache)
{
public:
omni::core::ObjectPtr<usdrt::xformcache::IXformCache> getCache(omni::fabric::UsdStageId stageId) noexcept
{
return omni::core::borrow(getCache_abi(stageId));
}
omni::core::ObjectPtr<usdrt::xformcache::IXformCache> getOrCreateCache(omni::fabric::UsdStageId stageId) noexcept
{
return omni::core::borrow(getOrCreateCache_abi(stageId));
}
};
// clang-format on
| 1,657 | C | 29.703703 | 119 | 0.747737 |
omniverse-code/kit/exts/usdrt.scenegraph/include/usdrt/xformcache/IXformCache.gen.h | // Copyright (c) 2022-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.
//
// --------- Warning: This is a build system generated file. ----------
//
//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.
#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>
#include <functional>
#include <type_traits>
#include <utility>
#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL
template <>
class omni::core::Generated<usdrt::xformcache::IXformCache_abi> : public usdrt::xformcache::IXformCache_abi
{
public:
OMNI_PLUGIN_INTERFACE("usdrt::xformcache::IXformCache")
bool attachToStage(omni::fabric::UsdStageId stageId) noexcept;
omni::fabric::UsdStageId getStageId() noexcept;
void syncXforms() noexcept;
void syncTargetedXforms(omni::fabric::PathC targetPath) noexcept;
usdrt::GfMatrix4d getLatestWorldXform(omni::fabric::PathC path) noexcept;
usdrt::GfMatrix4d computeWorldXform(omni::fabric::PathC path) noexcept;
};
#endif
#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL
inline bool omni::core::Generated<usdrt::xformcache::IXformCache_abi>::attachToStage(omni::fabric::UsdStageId stageId) noexcept
{
return attachToStage_abi(stageId);
}
inline omni::fabric::UsdStageId omni::core::Generated<usdrt::xformcache::IXformCache_abi>::getStageId() noexcept
{
return getStageId_abi();
}
inline void omni::core::Generated<usdrt::xformcache::IXformCache_abi>::syncXforms() noexcept
{
syncXforms_abi();
}
inline void omni::core::Generated<usdrt::xformcache::IXformCache_abi>::syncTargetedXforms(omni::fabric::PathC targetPath) noexcept
{
syncTargetedXforms_abi(targetPath);
}
inline usdrt::GfMatrix4d omni::core::Generated<usdrt::xformcache::IXformCache_abi>::getLatestWorldXform(
omni::fabric::PathC path) noexcept
{
return getLatestWorldXform_abi(path);
}
inline usdrt::GfMatrix4d omni::core::Generated<usdrt::xformcache::IXformCache_abi>::computeWorldXform(
omni::fabric::PathC path) noexcept
{
return computeWorldXform_abi(path);
}
#endif
#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
| 2,507 | C | 26.260869 | 130 | 0.750698 |
omniverse-code/kit/exts/usdrt.scenegraph/docs/index.rst | usdrt.scenegraph: USDRT Scenegraph API for Kit
##############################################
This extension loads the usdrt.scenegraph plugin
and adds the USDRT Python bindings into the Python path
for Kit.
USDRT is developed out of the usdrt repo and delivered
via the usdrt packman package. This extension is the
meant to be the singular load point for the
usdrt.scenegraph plugin within Kit.
Public documentation here:
https://docs.omniverse.nvidia.com/kit/docs/usdrt
.. toctree::
:maxdepth: 1
CHANGELOG
| 523 | reStructuredText | 20.833332 | 55 | 0.713193 |
omniverse-code/kit/exts/omni.kit.quicklayout/PACKAGE-LICENSES/omni.kit.quicklayout-LICENSE.md | Copyright (c) 2020, 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. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
omniverse-code/kit/exts/omni.kit.quicklayout/config/extension.toml | [package]
version = "1.1.1"
authors = ["NVIDIA"]
title = "Layout Control Tools"
description = "Set of tools for controlling layout."
readme = "docs/README.md"
repository = ""
category = "Core"
feature = true
keywords = ["layout", "workspace"]
changelog = "docs/CHANGELOG.md"
preview_image = "data/preview.png"
icon = "data/icon.svg"
[dependencies]
"omni.kit.mainwindow" = {}
"omni.kit.window.filepicker" = {}
"omni.client" = {}
"omni.ui" = {}
"omni.usd.libs" = {}
"omni.kit.menu.utils" = {}
[[python.module]]
name = "omni.kit.quicklayout"
[settings]
persistent.app.quicklayout.defaultLayout = "$$last_used$$"
persistent.app.quicklayout.lastUsedLayout = "$$none$$"
[[test]]
args = [
"--/app/window/dpiScaleOverride=1.0",
"--/app/window/scaleToMonitor=false",
"--no-window"
]
pyCoverageIncludeDependencies = false
dependencies = [
"omni.kit.mainwindow",
"omni.kit.renderer.capture",
"omni.kit.window.preferences",
"omni.kit.menu.utils",
"omni.kit.ui_test",
"omni.kit.test_suite.helpers",
]
| 1,031 | TOML | 20.957446 | 58 | 0.668283 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/quicklayout.py | # 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.
#
from omni.kit.widget.filebrowser import FileBrowserItem
from omni.kit.window.filepicker import FilePickerDialog
from pathlib import Path
from omni.ui.workspace_utils import CompareDelegate
import carb
import carb.tokens
import json
import omni.client
import omni.ui as ui
import traceback
class QuickLayout:
"""Namespace that has the methods to load and save the layout"""
def __init__(self):
self._dialog = None
def destroy(self): # pragma: no cover
if self._dialog:
self._dialog.destroy()
self._dialog = None
def __on_filter_item(self, item: FileBrowserItem) -> bool:
if not item or item.is_folder:
return True
if self._dialog.current_filter_option == 0:
# Show only files with listed extensions
if item.path.endswith(".json"):
return True
else:
return False
else:
# Show All Files (*)
return True
@staticmethod
def __get_workspace_dir() -> str:
"""Return the workspace file"""
token = carb.tokens.get_tokens_interface()
dir = token.resolve("${data}")
# FilePickerDialog needs the capital drive. In case it's linux, the
# first letter will be / and it's still OK.
dir = dir[:1].upper() + dir[1:]
return dir
@staticmethod
def __get_workspace_file() -> str:
"""Return the workspace file"""
dir = QuickLayout.__get_workspace_dir()
return f"{dir}/user.layout.json"
def __on_apply_save(self, filename: str, dir: str):
"""Called when the user presses the Save button in the dialog"""
# Get the file extension from the filter
if self._dialog.current_filter_option == 0 and not filename.lower().endswith(".json"):
filename += ".json"
self._dialog.hide()
self.save_file(omni.client.combine_urls(dir if dir.endswith("/") else dir+"/", filename))
def __on_apply_load(self, filename, dir):
"""Called when the user presses the Load button in the dialog"""
self._dialog.hide()
self.load_file(omni.client.combine_urls(dir if dir.endswith("/") else dir+"/", filename))
@staticmethod
def save_file(workspace_file: str):
"""Save the layout to the workspace file"""
workspace_dump = ui.Workspace.dump_workspace()
payload = bytes(json.dumps(workspace_dump, sort_keys=True, indent=2).encode("utf-8"))
result = omni.client.write_file(workspace_file, payload)
if result != omni.client.Result.OK: # pragma: no cover
carb.log_error(f"[quicklayout] The workspace cannot be written to {workspace_file}, error code: {result}")
return
carb.log_info(f"[quicklayout] The workspace saved to {workspace_file}")
@staticmethod
def load_file(workspace_file: str, keep_windows_open=False):
"""Load the layout from the workspace file"""
result, _, content = omni.client.read_file(workspace_file)
if result != omni.client.Result.OK: # pragma: no cover
carb.log_error(f"[quicklayout] Can't read the workspace file {workspace_file}, error code: {result}")
return
data = json.loads(memoryview(content).tobytes().decode("utf-8"))
ui.Workspace.restore_workspace(data, keep_windows_open)
carb.log_info(f"[quicklayout] The workspace is loaded from {workspace_file}")
@staticmethod
def compare_file(workspace_file: str, compare_delegate: CompareDelegate=CompareDelegate()):
"""Load the layout from the workspace file"""
result, _, content = omni.client.read_file(workspace_file)
if result != omni.client.Result.OK: # pragma: no cover
carb.log_error(f"[quicklayout] Can't read the workspace file {workspace_file}, error code: {result}")
return
data = json.loads(memoryview(content).tobytes().decode("utf-8"))
result = ui.Workspace.compare_workspace(data, compare_delegate=compare_delegate)
carb.log_info(f"[quicklayout] compared {workspace_file} with workspace")
return result
def save(self, menu: str, value: bool):
"""Save layout with the dialog"""
# Remove previously opened dialog
self.destroy()
self._dialog = FilePickerDialog(
"Select File to Save Layout",
apply_button_label="Save",
current_directory=QuickLayout.__get_workspace_dir(),
click_apply_handler=self.__on_apply_save,
item_filter_options=["JSON Files (*.json)", "All Files (*)"],
item_filter_fn=self.__on_filter_item,
)
def load(self, menu: str, value: bool):
"""Load layout with the dialog"""
# Remove previously opened dialog
self.destroy()
self._dialog = FilePickerDialog(
"Select File to Load Layout",
apply_button_label="Load",
current_directory=QuickLayout.__get_workspace_dir(),
click_apply_handler=self.__on_apply_load,
item_filter_options=["JSON Files (*.json)", "All Files (*)"],
item_filter_fn=self.__on_filter_item,
)
@staticmethod
def quick_save(menu: str, value: bool):
workspace_file = QuickLayout.__get_workspace_file()
QuickLayout.save_file(workspace_file)
@staticmethod
def quick_load(menu: str, value: bool):
workspace_file = QuickLayout.__get_workspace_file()
QuickLayout.load_file(workspace_file)
| 5,988 | Python | 38.662251 | 118 | 0.635939 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/quicklayout_extension.py | # 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.
#
from .quicklayout import QuickLayout
import omni.ext
import omni.kit.ui
class QuickLayoutExtension(omni.ext.IExt):
def on_startup(self, ext_id):
self.__quick_layout = QuickLayout()
editor_menu = omni.kit.ui.get_editor_menu()
if editor_menu:
self._menu_save = editor_menu.add_item("Window/Layout/Save Layout...", self.__quick_layout.save)
self._menu_load = editor_menu.add_item("Window/Layout/Load Layout...", self.__quick_layout.load)
self._menu_quick_save = editor_menu.add_item("Window/Layout/Quick Save", QuickLayout.quick_save)
self._menu_quick_load = editor_menu.add_item("Window/Layout/Quick Load", QuickLayout.quick_load)
def on_shutdown(self): # pragma: no cover
self._menu_save = None
self._menu_load = None
self._menu_quick_save = None
self._menu_quick_load = None
self._menu = None
self.__quick_layout.destroy()
self.__quick_layout = None
| 1,423 | Python | 42.151514 | 108 | 0.691497 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/layout_templates_page.py | # 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.
#
import re
import os
import carb.settings
import omni.kit.app
import omni.ui as ui
from omni.kit.window.preferences import PreferenceBuilder, SettingType, PERSISTENT_SETTINGS_PREFIX
from omni.kit.quicklayout import QuickLayout
class LayoutTemplatesPreferences(PreferenceBuilder):
def __init__(self):
super().__init__("Template Startup")
def build(self):
layout_names = {"Open Last Used Layout": "$$last_used$$"}
for item in QuickLayout.get_default_layouts():
layout_names[item[0]] = item[0]
with ui.VStack(height=0):
with self.add_frame("Default Layout"):
with ui.VStack():
self.create_setting_widget_combo("Default Layout", PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout", layout_names, setting_is_index=True)
| 1,262 | Python | 38.468749 | 170 | 0.722662 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/__init__.py | # 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.
#
__all__ = ["QuickLayoutExtension", "QuickLayout"]
from .quicklayout_extension import QuickLayoutExtension
from .quicklayout import QuickLayout
| 577 | Python | 43.461535 | 76 | 0.807626 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/tests/test_quicklayout_menu.py | ## 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.
##
import os
import carb
import omni.kit.app
from omni.kit.test.async_unittest import AsyncTestCase
import omni.usd
import omni.ui as ui
from omni.kit import ui_test
from pxr import Vt, Gf
from omni.kit.test_suite.helpers import get_test_data_path, arrange_windows
from omni.kit.quicklayout import QuickLayout
from omni.kit.menu.utils import MenuItemDescription, MenuAlignment
from omni.kit.ui_test.query import MenuRef
PERSISTENT_SETTINGS_PREFIX = "/persistent"
class TestQuicklayoutMenu(AsyncTestCase):
# Before running each test
async def setUp(self):
await arrange_windows()
# carb.settings.get_settings().set(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout", "$$last_used$$")
self.assertEqual(QuickLayout.get_default_layouts(), [])
data_path = get_test_data_path(__name__)
self._layout_data = [ ["Test 1", f"{data_path}/layouts/test1.json", carb.input.KeyboardInput.KEY_1],
["Test 2", f"{data_path}/layouts/test2.json", carb.input.KeyboardInput.KEY_2]]
QuickLayout.add_default_layouts(self._layout_data)
# After running each test
async def tearDown(self):
QuickLayout.remove_default_layouts(self._layout_data)
carb.settings.get_settings().set(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout", "$$last_used$$")
self.assertEqual(QuickLayout.get_default_layouts(), [])
async def test_layout_menu(self):
# add layout placeholder
menu_placeholder = [MenuItemDescription(name="placeholder", show_fn=lambda: False)]
omni.kit.menu.utils.add_menu_items(menu_placeholder, name="Layout")
await ui_test.human_delay(10)
layout_menu_items = []
def add_layout_menu_entry(name, parameter, key):
item = MenuItemDescription(name=name)
layout_menu_items.append(item)
for item in QuickLayout.get_default_layouts():
add_layout_menu_entry(f"{item[0]}", item[1], item[2])
# add menu
layout_delegate = QuickLayout.LayoutMenuDelegate(read_fn=lambda: "Test 2",
layout_id="Test 2",
text_width=175,
hotkey_width=75)
omni.kit.menu.utils.add_menu_items(layout_menu_items, "Layout", delegate=layout_delegate)
await ui_test.human_delay(10)
# click layout
layout_menu = omni.kit.ui_test.get_menubar().find_menu("Layout")
await layout_menu.click()
await ui_test.human_delay(10)
# verify menu icon status
layout_menu_icons = layout_menu.widget.delegate._layout_menu_icons
self.assertFalse(layout_menu.widget.delegate._layout_menu_icons['Test 1']['selected_image'].enabled)
self.assertTrue(layout_menu.widget.delegate._layout_menu_icons['Test 2']['selected_image'].enabled)
# remove menus
omni.kit.menu.utils.remove_menu_items(layout_menu_items, name="Layout")
omni.kit.menu.utils.remove_menu_items(menu_placeholder, name="Layout")
await ui_test.human_delay(10)
| 3,637 | Python | 42.309523 | 121 | 0.659335 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/tests/__init__.py | # 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.
#
from .quicklayout_test import TestQuickLayout
from .test_menus import TestQuickLayoutMenus
| 519 | Python | 46.272723 | 76 | 0.818882 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/tests/test_quicklayout_preferences.py | ## 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.
##
import os
import carb
import omni.kit.app
from omni.kit.test.async_unittest import AsyncTestCase
import omni.usd
from omni.kit import ui_test
from pxr import Vt, Gf
from omni.kit.test_suite.helpers import open_stage, get_test_data_path, select_prims, wait_stage_loading, wait_for_window, arrange_windows
from omni.kit.quicklayout import QuickLayout
PERSISTENT_SETTINGS_PREFIX = "/persistent"
class TestQuicklayoutPreferences(AsyncTestCase):
# Before running each test
async def setUp(self):
await arrange_windows()
carb.settings.get_settings().set(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout", "$$last_used$$")
self.assertEqual(QuickLayout.get_default_layouts(), [])
data_path = get_test_data_path(__name__)
self._layout_data = [ ["Test 1", f"{data_path}/layouts/test1.json", carb.input.KeyboardInput.KEY_1],
["Test 2", f"{data_path}/layouts/test2.json", carb.input.KeyboardInput.KEY_2]]
QuickLayout.add_default_layouts(self._layout_data)
# After running each test
async def tearDown(self):
QuickLayout.remove_default_layouts(self._layout_data)
carb.settings.get_settings().set(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout", "$$last_used$$")
self.assertEqual(QuickLayout.get_default_layouts(), [])
async def test_layout_preferences(self):
omni.kit.window.preferences.show_preferences_window()
await ui_test.human_delay(50)
for page in omni.kit.window.preferences.get_page_list():
if page.get_title() == "Template Startup":
omni.kit.window.preferences.select_page(page)
await ui_test.human_delay(50)
frame = ui_test.find("Preferences//Frame/**/CollapsableFrame[*].identifier=='preferences_builder_Default Layout'")
frame.find("**/ComboBox[*].identifier=='/persistent/app/quicklayout/defaultLayout'").model._current_index.as_int = 1
await ui_test.human_delay(10)
self.assertEqual(carb.settings.get_settings().get(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout"), "Test 1")
frame = ui_test.find("Preferences//Frame/**/CollapsableFrame[*].identifier=='preferences_builder_Default Layout'")
frame.find("**/ComboBox[*].identifier=='/persistent/app/quicklayout/defaultLayout'").model._current_index.as_int = 0
await ui_test.human_delay(10)
self.assertEqual(carb.settings.get_settings().get(PERSISTENT_SETTINGS_PREFIX + "/app/quicklayout/defaultLayout"), "$$last_used$$")
return
self.assertTrue(False, "Quicklayout preferences page not found")
| 3,171 | Python | 50.999999 | 146 | 0.690003 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/tests/test_menus.py | ## 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.
##
from omni.ui.tests.test_base import OmniUiTest
import omni.kit
import omni.ui as ui
import omni.kit.ui_test as ui_test
class TestQuickLayoutMenus(OmniUiTest):
async def test_menus(self):
menu_widget = ui_test.get_menubar()
await menu_widget.find_menu("Window").click()
await menu_widget.find_menu("Layout").click()
await menu_widget.find_menu("Quick Save").click()
await ui_test.human_delay(10)
await menu_widget.find_menu("Window").click()
await menu_widget.find_menu("Layout").click()
await menu_widget.find_menu("Quick Load").click()
await ui_test.human_delay(10)
| 1,082 | Python | 39.11111 | 77 | 0.719963 |
omniverse-code/kit/exts/omni.kit.quicklayout/omni/kit/quicklayout/tests/quicklayout_test.py | ## 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.
##
from ..quicklayout import QuickLayout
from omni.ui.tests.test_base import OmniUiTest
from pathlib import Path
import json
import omni.kit
import omni.ui as ui
import os
import tempfile
from omni.kit.mainwindow import get_main_window
CURRENT_PATH = Path(__file__).parent.joinpath("../../../../data")
ROOT_WINDOW_NAME = "DockSpace"
class TestQuickLayout(OmniUiTest):
# Before running each test
async def setUp(self):
await super().setUp()
self._golden_img_dir = CURRENT_PATH.absolute().resolve().joinpath("tests")
self._dump_workspace = ui.Workspace.dump_workspace()
# After running each test
async def tearDown(self):
self._golden_img_dir = None
ui.Workspace.restore_workspace(self._dump_workspace)
await super().tearDown()
async def test_floating(self):
ui.Workspace.clear()
window_left = ui.Window("Left", width=100, height=100, position_x=10, position_y=10)
window_right = ui.Window("Right", width=100, height=100, position_x=120, position_y=10)
await omni.kit.app.get_app().next_update_async()
temp_file = Path(tempfile.gettempdir()).joinpath("workspace_" + next(tempfile._get_candidate_names()) + ".json")
QuickLayout.save_file(f"{temp_file}")
with open(f"{temp_file}") as json_file:
data = json.load(json_file)
os.remove(f"{temp_file}")
left_pos = 0
right_pos = 0
for win in data:
if "title" in win:
if win["title"] == "Left":
left_pos = win['position_x']
elif win["title"] == "Right":
right_pos = win['position_x']
# self.assertEqual(len(data), 3) # Not true if test_restore is run first
self.assertEqual(left_pos, 10.0)
self.assertEqual(right_pos, 120.0)
async def test_docking(self):
ui.Workspace.clear()
window_left = ui.Window("Left2", width=100, height=100, position_x=10, position_y=10)
window_right = ui.Window("Right2", width=100, height=100, position_x=120, position_y=10)
target_window = ui.Workspace.get_window(ROOT_WINDOW_NAME)
await omni.kit.app.get_app().next_update_async()
window_left.dock_in(target_window, ui.DockPosition.SAME)
window_right.dock_in(window_left, ui.DockPosition.RIGHT, 0.5)
await omni.kit.app.get_app().next_update_async()
temp_file = Path(tempfile.gettempdir()).joinpath("workspace_" + next(tempfile._get_candidate_names()) + ".json")
QuickLayout.save_file(f"{temp_file}")
with open(f"{temp_file}") as json_file:
data = json.load(json_file)
os.remove(f"{temp_file}")
self.assertEqual(len(data[0]["children"]), 2)
self.assertIn(data[0]["children"][0]["position"], ["LEFT", "RIGHT"])
self.assertIn(data[0]["children"][1]["position"], ["LEFT", "RIGHT"])
async def test_restore(self):
data = [
{
"children": [
{
"children": [
{
"dock_id": 1,
"height": 100,
"selected_in_dock": True,
"title": "LeftDocked",
"visible": True,
"width": 100,
}
],
"dock_id": 1,
"position": "LEFT",
},
{
"children": [
{
"dock_id": 2,
"height": 100,
"selected_in_dock": False,
"title": "RightDocked",
"visible": True,
"width": 100,
}
],
"dock_id": 2,
"position": "RIGHT",
},
],
"dock_id": 0,
}
]
await self.create_test_area()
window_left = ui.Window("LeftDocked")
with window_left.frame:
ui.Rectangle(style={"background_color": 0xFFF07E4D})
window_right = ui.Window("RightDocked")
with window_right.frame:
ui.Rectangle(style={"background_color": 0xFF7DF0A6})
await omni.kit.app.get_app().next_update_async()
temp_file = Path(tempfile.gettempdir()).joinpath("workspace_" + next(tempfile._get_candidate_names()) + ".json")
# Save data to json file and open it in QuickLayout
with open(f"{temp_file}", "w") as json_file:
json.dump(data, json_file, sort_keys=True, indent=2)
QuickLayout.load_file(f"{temp_file}")
await omni.kit.app.get_app().next_update_async()
# for code coverage. Real QuickLayout.compare_file test is in omni.kit.test_suite.layout as it needs windows
QuickLayout.compare_file(f"{temp_file}")
# We don't test tab bar
window_left.dock_tab_bar_visible = False
window_right.dock_tab_bar_visible = False
os.remove(f"{temp_file}")
await self.finalize_test(golden_img_dir=self._golden_img_dir)
| 5,838 | Python | 35.72327 | 120 | 0.538883 |
omniverse-code/kit/exts/omni.kit.quicklayout/docs/CHANGELOG.md | # QUICKLAYOUT CHANGELOG
## [1.1.1] - 2023-01-31
### Changed
- Removed python.module for tests, from extension.toml
- Fixed tests that broke when run in random order
## [1.1.0] - 2023-01-11
### Changed
- Adding default layout template
## [1.0.2] - 2023-01-20
### Changed
- Fixed saving/loading using nucleus paths
## [1.0.1] - 2021-05-25
### Changed
- Using `omni.client` for saving and loading the workspace
## [1.0.0] - 2021-02-02
### Added
- Initial extension that saves/loads the layout to the userdirectory
| 515 | Markdown | 22.454544 | 68 | 0.691262 |
omniverse-code/kit/exts/omni.kit.quicklayout/docs/README.md | # Layout Control Tools [omni.kit.quicklayout]
Set of tools for controlling layout.
Creates two menu items.
- `Window/Layout/Save Layout`: saves the current layout to the file `"${data}/user.layout.json"`
- `Window/Layout/Load Layout`: loads the layout from the file `"${data}/user.layout.json"` | 298 | Markdown | 32.222219 | 96 | 0.738255 |
omniverse-code/kit/exts/omni.kit.menu.common/PACKAGE-LICENSES/omni.kit.menu.common-LICENSE.md | Copyright (c) 2020, 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. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
omniverse-code/kit/exts/omni.kit.menu.common/config/extension.toml | [package]
# Semantic Versioning is used: https://semver.org/
version = "1.0.3"
category = "Internal"
# Lists people or organizations that are considered the "authors" of the package.
authors = ["NVIDIA"]
# The title and description fields are primarily for displaying extension info in UI
title = "Common Menu"
description="Implementation of parts of Window and Help menus."
# URL of the extension source repository.
repository = ""
# Keywords for the extension
keywords = ["kit", "ui", "menu"]
# Location of change log file in target (final) folder of extension, relative to the root.
# More info on writing changelog: https://keepachangelog.com/en/1.0.0/
changelog = "docs/CHANGELOG.md"
# Preview image. Folder named "data" automatically goes in git lfs (see .gitattributes file).
preview_image = "data/preview.png"
[dependencies]
"omni.usd" = {}
"omni.kit.menu.utils" = {}
[[python.module]]
name = "omni.kit.menu.common"
[settings]
# Setting this to false because we also set F11 in this ext.
exts."omni.appwindow".listenF11 = false
exts."omni.kit.menu.common".external_kit_sdk_url = "https://docs.omniverse.nvidia.com/prod_kit/prod_kit/overview.html"
exts."omni.kit.menu.common".internal_kit_sdk_url = "https://omniverse.gitlab-master-pages.nvidia.com/omni-docs/prod_kit/prod_kit/overview.html"
exts."omni.kit.menu.common".external_kit_manual_url = "https://docs.omniverse.nvidia.com/py/kit/index.html"
exts."omni.kit.menu.common".internal_kit_manual_url = "https://omniverse-docs.s3-website-us-east-1.amazonaws.com/kit-manual/index-internal.html"
[[test]]
args = [
"--/renderer/enabled=pxr",
"--/renderer/active=pxr",
"--/renderer/multiGpu/enabled=false",
"--/renderer/multiGpu/autoEnable=false", # Disable mGPU with PXR due to OM-51026, OM-53611
"--/renderer/multiGpu/maxGpuCount=1",
"--/app/asyncRendering=false",
"--/app/file/ignoreUnsavedStage=true",
"--/app/window/dpiScaleOverride=1.0",
"--/app/window/scaleToMonitor=false",
"--/app/menu/legacy_mode=false",
# "--no-window", # Need window for fullscreen tests
]
dependencies = [
"omni.hydra.pxr",
"omni.kit.renderer.capture",
"omni.kit.mainwindow",
"omni.kit.ui_test",
"omni.kit.material.library",
"omni.kit.viewport.utility",
"omni.kit.hotkeys.core"
]
stdoutFailPatterns.exclude = [
"*HydraRenderer failed to render this frame*", # Can drop a frame or two rendering with OpenGL interop
"*Cannot use omni.hydra.pxr without OpenGL interop*" # Linux TC configs with multi-GPU might not have OpenGL available
]
timeout = 900
| 2,579 | TOML | 34.342465 | 144 | 0.714618 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/__init__.py | from .scripts import *
| 23 | Python | 10.999995 | 22 | 0.73913 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/scripts/common.py | import omni.ext
import omni.kit.menu.utils
from .legacy_help import HelpExtension
from .legacy_window import WindowExtension
class CommonMenuExtension(omni.ext.IExt):
def on_startup(self, ext_id):
self._legacy_help = HelpExtension()
self._legacy_window = WindowExtension()
def on_shutdown(self):
del self._legacy_help
del self._legacy_window
| 385 | Python | 24.733332 | 47 | 0.706494 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/scripts/legacy_window.py | import carb
import carb.input
import carb.settings
import omni.kit.ui
import omni.appwindow
import omni.kit.menu.utils
import omni.ui as ui
from carb.input import KeyboardInput as Key
class WindowExtension:
def __init__(self):
self._appwindow = omni.appwindow.get_default_app_window()
self._settings = carb.settings.get_settings()
self.WINDOW_UI_TOGGLE_VISIBILITY_MENU = "Window/UI Toggle Visibility"
self.WINDOW_FULLSCREEN_MODE_MENU = "Window/Fullscreen Mode"
self.WINDOW_DPI_SCALE_INCREASE_MENU = "Window/DPI Scale/Increase"
self.WINDOW_DPI_SCALE_DECREASE_MENU = "Window/DPI Scale/Decrease"
self.WINDOW_DPI_SCALE_RESET_MENU = "Window/DPI Scale/Reset"
self.SHOW_DPI_SCALE_MENU_SETTING = "/app/window/showDpiScaleMenu"
self.DPI_SCALE_OVERRIDE_SETTING = "/app/window/dpiScaleOverride"
self.DPI_SCALE_OVERRIDE_DEFAULT = -1.0
self.DPI_SCALE_OVERRIDE_MIN = 0.5
self.DPI_SCALE_OVERRIDE_MAX = 5.0
self.DPI_SCALE_OVERRIDE_STEP = 0.5
self.menus = []
menu = omni.kit.ui.get_editor_menu()
if menu:
window_ui_toggle_visibility_menu = menu.add_item(self.WINDOW_UI_TOGGLE_VISIBILITY_MENU, None, priority=51)
window_ui_toggle_visibility_action = omni.kit.menu.utils.add_action_to_menu(self.WINDOW_UI_TOGGLE_VISIBILITY_MENU, lambda *_: self.on_toggle_ui(), "UiToggle", (0, Key.F7))
self.menus.append((window_ui_toggle_visibility_menu, window_ui_toggle_visibility_action))
window_fullscreen_mode_menu = menu.add_item(self.WINDOW_FULLSCREEN_MODE_MENU, None, priority=52)
window_fullscreen_mode_menu_action = omni.kit.menu.utils.add_action_to_menu(self.WINDOW_FULLSCREEN_MODE_MENU, lambda *_: self.on_fullscreen(), "FullscreenMode", (0, Key.F11))
self.menus.append((window_fullscreen_mode_menu, window_fullscreen_mode_menu_action))
self._settings.set_default_bool(self.SHOW_DPI_SCALE_MENU_SETTING, False)
if self._settings.get_as_bool(self.SHOW_DPI_SCALE_MENU_SETTING):
window_dpi_scale_increase_menu = menu.add_item(self.WINDOW_DPI_SCALE_INCREASE_MENU, None, priority=53)
window_dpi_scale_increase_menu_action = omni.kit.menu.utils.add_action_to_menu(self.WINDOW_DPI_SCALE_INCREASE_MENU, lambda *_: self.on_dpi_scale_increase(), "DPIScaleIncrease", (carb.input.KEYBOARD_MODIFIER_FLAG_CONTROL, Key.EQUAL))
self.menus.append((window_dpi_scale_increase_menu, window_dpi_scale_increase_menu_action))
window_dpi_scale_decrease_menu = menu.add_item(self.WINDOW_DPI_SCALE_DECREASE_MENU, None, priority=54)
window_dpi_scale_decrease_menu_action = omni.kit.menu.utils.add_action_to_menu(self.WINDOW_DPI_SCALE_DECREASE_MENU, lambda *_: self.on_dpi_scale_decrease(), "DPIScaleDecrease", (carb.input.KEYBOARD_MODIFIER_FLAG_CONTROL, Key.MINUS))
self.menus.append((window_dpi_scale_decrease_menu, window_dpi_scale_decrease_menu_action))
window_dpi_scale_reset_menu = menu.add_item(self.WINDOW_DPI_SCALE_RESET_MENU, None, priority=55)
window_dpi_scale_reset_menu_action = omni.kit.menu.utils.add_action_to_menu(self.WINDOW_DPI_SCALE_RESET_MENU, lambda *_: self.on_dpi_scale_reset(), "DPIScaleReset")
self.menus.append((window_dpi_scale_reset_menu, window_dpi_scale_reset_menu_action))
# Sort top level menus:
menu.set_priority("Window", -6)
def __del__(self):
self.menus = None
def add_menu(self, *argv, **kwargs):
new_menu = omni.kit.ui.get_editor_menu().add_item(*argv, **kwargs)
self.menus.append(new_menu)
return new_menu
def set_ui_hidden(self, hide):
self._settings.set("/app/window/hideUi", hide)
def is_ui_hidden(self):
return self._settings.get("/app/window/hideUi")
def on_toggle_ui(self):
self.set_ui_hidden(not self.is_ui_hidden())
def on_fullscreen(self):
display_mode_lock = self._settings.get(f"/app/window/displayModeLock")
if display_mode_lock:
# Always stay in fullscreen_mode, only hide or show UI.
self.set_ui_hidden(not self.is_ui_hidden())
else:
# Only toggle fullscreen on/off when not display_mode_lock
was_fullscreen = self._appwindow.is_fullscreen()
self._appwindow.set_fullscreen(not was_fullscreen)
# Always hide UI in fullscreen
self.set_ui_hidden(not was_fullscreen)
def step_and_clamp_dpi_scale_override(self, increase):
# Get the current value.
dpi_scale = self._settings.get_as_float(self.DPI_SCALE_OVERRIDE_SETTING)
if dpi_scale == self.DPI_SCALE_OVERRIDE_DEFAULT:
dpi_scale = ui.Workspace.get_dpi_scale()
# Increase or decrease the current value by the setp value.
if increase:
dpi_scale += self.DPI_SCALE_OVERRIDE_STEP
else:
dpi_scale -= self.DPI_SCALE_OVERRIDE_STEP
# Clamp the new value between the min/max values.
dpi_scale = max(min(dpi_scale, self.DPI_SCALE_OVERRIDE_MAX), self.DPI_SCALE_OVERRIDE_MIN)
# Set the new value.
self._settings.set(self.DPI_SCALE_OVERRIDE_SETTING, dpi_scale)
def on_dpi_scale_increase(self):
self.step_and_clamp_dpi_scale_override(True)
def on_dpi_scale_decrease(self):
self.step_and_clamp_dpi_scale_override(False)
def on_dpi_scale_reset(self):
self._settings.set(self.DPI_SCALE_OVERRIDE_SETTING, self.DPI_SCALE_OVERRIDE_DEFAULT)
| 5,631 | Python | 48.840708 | 248 | 0.665068 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/scripts/legacy_help.py | import webbrowser
import os
import carb
import carb.input
import carb.settings
import omni.kit.app
import omni.kit.menu.utils
from carb.input import KeyboardInput as Key
from omni.kit.menu.utils import MenuItemDescription
class HelpExtension:
def __init__(self):
def get_discover_kit_sdk_path(settings):
if omni.kit.app.get_app().is_app_external():
return settings.get("/exts/omni.kit.menu.common/external_kit_sdk_url")
else:
return settings.get("/exts/omni.kit.menu.common/internal_kit_sdk_url")
def get_manual_url_path(settings):
if omni.kit.app.get_app().is_app_external():
return settings.get("/exts/omni.kit.menu.common/external_kit_manual_url")
else:
return settings.get("/exts/omni.kit.menu.common/internal_kit_manual_url")
def get_discover_reference_guide_path(settings):
if omni.kit.app.get_app().is_app_external():
return settings.get("/exts/omni.kit.menu.common/external_reference_guide_url")
else:
return settings.get("/exts/omni.kit.menu.common/internal_reference_guide_url")
settings = carb.settings.get_settings()
discover_reference_guide_path = get_discover_reference_guide_path(settings)
discover_kit_sdk_path = get_discover_kit_sdk_path(settings)
manual_url_path = get_manual_url_path(settings)
self._register_actions("omni.kit.menu.common", discover_reference_guide_path, discover_kit_sdk_path, manual_url_path)
reference_guide_name = settings.get("/exts/omni.kit.menu.common/reference_guide_name")
kit_sdk_name = settings.get("/exts/omni.kit.menu.common/kit_sdk_name")
kit_manual_name = settings.get("/exts/omni.kit.menu.common/kit_manual_name")
self._help_menu = []
if reference_guide_name:
self._help_menu.append(MenuItemDescription(
name=reference_guide_name,
onclick_action=("omni.kit.menu.common", "OpenRefGuide"),
hotkey=(0, Key.F1),
enabled=False if reference_guide_name is None else True
))
if kit_sdk_name:
self._help_menu.append(MenuItemDescription(
name=kit_sdk_name,
onclick_action=("omni.kit.menu.common", "OpenDevKitSDK"),
enabled=False if discover_kit_sdk_path is None else True
))
if kit_manual_name:
self._help_menu.append(MenuItemDescription(
name=kit_manual_name,
onclick_action=("omni.kit.menu.common", "OpenDevManual"),
enabled=False if manual_url_path is None else True
))
if self._help_menu:
omni.kit.menu.utils.add_menu_items(self._help_menu, "Help", 99)
def __del__(self):
omni.kit.menu.utils.remove_menu_items(self._help_menu, "Help")
self._deregister_actions("omni.kit.menu.common")
self.menus = None
def _register_actions(self, extension_id, discover_reference_guide_path, discover_kit_sdk_path, manual_url_path):
action_registry = omni.kit.actions.core.get_action_registry()
actions_tag = "Help Menu Actions"
# actions
action_registry.register_action(
extension_id,
"OpenRefGuide",
lambda: webbrowser.open(discover_reference_guide_path),
display_name="Help->Reference Guide",
description="Reference Guide",
tag=actions_tag,
)
action_registry.register_action(
extension_id,
"OpenDevKitSDK",
lambda: webbrowser.open(discover_kit_sdk_path),
display_name="Help->Discover Kit SDK",
description="Discover Kit SDK",
tag=actions_tag,
)
action_registry.register_action(
extension_id,
"OpenDevManual",
lambda: webbrowser.open(manual_url_path),
display_name="Help->Developers Manual",
description="Developers Manual",
tag=actions_tag,
)
def _deregister_actions(self, extension_id):
action_registry = omni.kit.actions.core.get_action_registry()
if action_registry:
action_registry.deregister_all_actions_for_extension(extension_id)
| 4,436 | Python | 38.616071 | 125 | 0.606402 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/scripts/__init__.py | from .common import *
| 22 | Python | 10.499995 | 21 | 0.727273 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/tests/common_tests.py | import sys
import re
import asyncio
import unittest
import carb
import omni.kit.test
from .test_func_common_window import *
from .test_func_common_help import *
class TestMenuCommon(omni.kit.test.AsyncTestCase):
async def setUp(self):
pass
async def tearDown(self):
pass
async def test_common_menus(self):
import omni.kit.material.library
# wait for material to be preloaded so create menu is complete & menus don't rebuild during tests
await omni.kit.material.library.get_mdl_list_async()
await ui_test.human_delay()
menus = omni.kit.menu.utils.get_merged_menus()
prefix = "common_test"
to_test = []
this_module = sys.modules[__name__]
for key in menus.keys():
# edit menu only
if key.startswith("Window") or key.startswith("Help"):
for item in menus[key]['items']:
if item.name != "" and item.has_action():
key_name = re.sub('\W|^(?=\d)','_', key.lower())
func_name = re.sub('\W|^(?=\d)','_', item.name.replace("${kit}/", "").lower())
while key_name and key_name[-1] == "_":
key_name = key_name[:-1]
while func_name and func_name[-1] == "_":
func_name = func_name[:-1]
test_fn = f"{prefix}_func_{key_name}_{func_name}"
try:
to_call = getattr(this_module, test_fn)
to_test.append((to_call, test_fn, item.original_menu_item if item.original_menu_item else item))
except AttributeError:
carb.log_error(f"test function \"{test_fn}\" not found")
if item.original_menu_item and item.original_menu_item.hotkey:
test_fn = f"{prefix}_hotkey_func_{key_name}_{func_name}"
try:
to_call = getattr(this_module, test_fn)
to_test.append((to_call, test_fn, item.original_menu_item))
except AttributeError:
carb.log_error(f"test function \"{test_fn}\" not found")
for to_call, test_fn, menu_item in to_test:
await omni.usd.get_context().new_stage_async()
omni.kit.menu.utils.refresh_menu_items("Window")
omni.kit.menu.utils.refresh_menu_items("Help")
await ui_test.human_delay()
print(f"Running test {test_fn}")
try:
await to_call(self, menu_item)
except Exception as exc:
carb.log_error(f"error {test_fn} failed - {exc}")
import traceback
traceback.print_exc(file=sys.stdout)
def get_stage_prims(self):
stage = omni.usd.get_context().get_stage()
return [prim.GetPath().pathString for prim in stage.TraverseAll() if not omni.usd.is_hidden_type(prim)]
| 3,094 | Python | 41.986111 | 124 | 0.520039 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/tests/__init__.py | from .common_tests import *
| 28 | Python | 13.499993 | 27 | 0.75 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/tests/test_func_common_window.py | import asyncio
import carb
import omni.usd
import omni.ui as ui
from omni.kit import ui_test
from carb.input import KeyboardInput
from omni.kit.menu.utils import MenuItemDescription, MenuLayout
from omni.kit.viewport.utility import get_active_viewport_window, get_num_viewports
DPI_SCALE_OVERRIDE_SETTING = "/app/window/dpiScaleOverride"
def get_hide_ui():
hide_ui = carb.settings.get_settings().get("/app/window/hideUi")
if hide_ui == None:
return False
return hide_ui
async def common_test_func_window_viewport(tester, menu_item = None):
# XXX: Unclear where this API is used, but it originally took an unused menu_item
if menu_item:
carb.log_error("common_test_func_window_new_viewport_window does not use a menu_item")
# Get the default Viewport name, most likely 'Viewport'
default_vp_window_name = carb.settings.get_settings().get("/exts/omni.kit.viewport.window/startup/windowName")
default_vp_window_name = default_vp_window_name or "Viewport"
window_menu = ui_test.get_menubar().find_menu("Window")
tester.assertIsNotNone(window_menu)
# There will always be a "Viewport" menu item, but on legacy it is a single item otherwise a sub-menu container
viewport_menu = window_menu.find_menu("Viewport")
tester.assertIsNotNone(viewport_menu)
# Build up the sub-menu (and full menu-path) that will be used
vp_menu_entry_name = f"{default_vp_window_name} 1"
full_default_vp_menu_path = f"Window/Viewport/{default_vp_window_name} 1"
# If it doesnt't exists as a child of the "Viewport" menu-item, assume legacy
vp_show_menu_entry = viewport_menu.find_menu(vp_menu_entry_name)
if not vp_show_menu_entry:
viewport_menu = window_menu
vp_menu_entry_name = default_vp_window_name
full_default_vp_menu_path = f"Window/{default_vp_window_name}"
vp_show_menu_entry = window_menu.find_menu(vp_menu_entry_name)
# Needs to be valid by now
tester.assertIsNotNone(vp_show_menu_entry)
# Pre-check that the Viewport Window can also be found
viewport_window = get_active_viewport_window(window_name=default_vp_window_name)
tester.assertIsNotNone(viewport_window)
# verify initial visibility and check state
tester.assertTrue(viewport_window.visible)
tester.assertTrue(vp_show_menu_entry.widget.checked)
# use menu
await ui_test.menu_click(full_default_vp_menu_path)
await ui_test.human_delay()
# verify
tester.assertFalse(viewport_window.visible)
tester.assertFalse(vp_show_menu_entry.widget.checked)
# use menu
await ui_test.menu_click(full_default_vp_menu_path)
await ui_test.human_delay()
# verify
tester.assertTrue(viewport_window.visible)
tester.assertTrue(vp_show_menu_entry.widget.checked)
async def common_test_func_window_ui_toggle_visibility(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertTrue(get_hide_ui() == False)
# use menu
await ui_test.menu_click("Window/UI Toggle Visibility")
await ui_test.human_delay(50)
# verify state
tester.assertTrue(get_hide_ui() == True)
# cannot use menu so use hotkey instead
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(get_hide_ui() == False)
async def common_test_hotkey_func_window_ui_toggle_visibility(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertTrue(get_hide_ui() == False)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(get_hide_ui() == True)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(get_hide_ui() == False)
async def common_test_func_window_fullscreen_mode(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == False)
# use menu
await ui_test.menu_click("Window/Fullscreen Mode")
await ui_test.human_delay(50)
# verify state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == True)
# cannot use menu so use hotkey instead
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == False)
async def common_test_hotkey_func_window_fullscreen_mode(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == False)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == True)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertTrue(omni.appwindow.get_default_app_window().is_fullscreen() == False)
async def common_test_func_window_new_viewport_window(tester, menu_item = None):
# XXX: Unclear where this API is used, but it originally took an unused menu_item
if menu_item:
carb.log_error("common_test_func_window_new_viewport_window does not use a menu_item")
# verify default state
tester.assertEqual(get_num_viewports(), 1)
# All functionaliyt contained in Window menu
window_menu = ui_test.get_menubar().find_menu("Window")
tester.assertIsNotNone(window_menu)
# There will always be a "Viewport" menu item, but on legacy it is a single item otherwise a sub-menu container
viewport_menu = window_menu.find_menu("Viewport")
tester.assertIsNotNone(viewport_menu)
# use menu
if viewport_menu.find_menu("Viewport 2"):
await ui_test.menu_click("Window/Viewport/Viewport 2")
else:
await ui_test.menu_click("Window/New Viewport Window")
await ui_test.human_delay()
# verify
tester.assertEqual(get_num_viewports(), 2)
# close new viewport window
viewport_window = get_active_viewport_window(window_name="Viewport 2")
if viewport_window:
viewport_window.visible = False
viewport_window.destroy()
del viewport_window
async def common_test_func_window_dpi_scale_increase(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
# use menu
await ui_test.menu_click("Window/DPI Scale/Increase")
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.5)
# cannot use menu so use hotkey instead
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 2.0)
# reset state
carb.settings.get_settings().set(DPI_SCALE_OVERRIDE_SETTING, 1.0)
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
async def common_test_hotkey_func_window_dpi_scale_increase(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.5)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 2.0)
# reset state
carb.settings.get_settings().set(DPI_SCALE_OVERRIDE_SETTING, 1.0)
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
async def common_test_func_window_dpi_scale_decrease(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
# use menu
await ui_test.menu_click("Window/DPI Scale/Decrease")
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 0.5)
# cannot use menu so use hotkey instead
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state - still 0.5 because it gets clamped to the min
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 0.5)
# reset state
carb.settings.get_settings().set(DPI_SCALE_OVERRIDE_SETTING, 1.0)
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
async def common_test_hotkey_func_window_dpi_scale_decrease(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 0.5)
# hotkey
await ui_test.emulate_keyboard_press(menu_item.hotkey[1], menu_item.hotkey[0])
await ui_test.human_delay(50)
# verify state - still 0.5 because it gets clamped to the min
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 0.5)
# reset state
carb.settings.get_settings().set(DPI_SCALE_OVERRIDE_SETTING, 1.0)
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
async def common_test_func_window_dpi_scale_reset(tester, menu_item: MenuItemDescription):
# verify default state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
# use menu
await ui_test.menu_click("Window/DPI Scale/Reset")
await ui_test.human_delay(50)
# verify state
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), -1.0)
# reset state
carb.settings.get_settings().set(DPI_SCALE_OVERRIDE_SETTING, 1.0)
tester.assertEqual(omni.appwindow.get_default_app_window().get_dpi_scale_override(), 1.0)
| 10,876 | Python | 36.506896 | 115 | 0.713406 |
omniverse-code/kit/exts/omni.kit.menu.common/omni/kit/menu/common/tests/test_func_common_help.py | import asyncio
import carb
import omni.usd
import omni.ui as ui
from omni.kit import ui_test
from omni.kit.menu.utils import MenuItemDescription, MenuLayout
async def common_test_func_help_usd_reference_guide(tester, menu_item: MenuItemDescription):
carb.log_warn("Help/USD Reference Guide - No test")
# don't know how to test this as it opens a webpage
async def common_test_hotkey_func_help_usd_reference_guide(tester, menu_item: MenuItemDescription):
carb.log_warn("Help/USD Reference Guide - No test")
# don't know how to test this as it opens a webpage
async def common_test_func_help_developers_manual(tester, menu_item: MenuItemDescription):
carb.log_warn("Help/Developers Manual - No test")
# don't know how to test this as it opens a webpage
async def common_test_func_help_discover_kit_sdk(tester, menu_item: MenuItemDescription):
carb.log_warn("Help/Discover Kit SDK - No test")
# don't know how to test this as it opens a webpage
| 983 | Python | 34.142856 | 99 | 0.748728 |
omniverse-code/kit/exts/omni.kit.menu.common/docs/CHANGELOG.md | # Changelog
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.0.3] - 2022-10-07
### Changes
- Adjust fullscreen test to work with hotkeys.core
- Add listenF11 setting for appwindow
## [1.0.2] - 2022-10-04
### Changes
- Test against new Viewport sub-menu
## [1.0.1] - 2022-05-23
### Changes
- Support legacy and new Viewport API
- Add dependency on omni.kit.viewport.utility
## [1.0.0] - 2021-11-16
### Changes
- Created from python/extensions-bundled/omni/kit/builtin/menu.py
| 518 | Markdown | 22.590908 | 80 | 0.698842 |
omniverse-code/kit/exts/omni.kit.menu.common/docs/index.rst | omni.kit.menu.common
###########################
Common Menu
.. toctree::
:maxdepth: 1
CHANGELOG
| 111 | reStructuredText | 6.466666 | 27 | 0.468468 |
omniverse-code/kit/exts/omni.appwindow/omni/appwindow/__init__.py | import carb.events
from ._appwindow import *
| 45 | Python | 14.333329 | 25 | 0.777778 |
omniverse-code/kit/exts/omni.appwindow/omni/appwindow/_appwindow.pyi | from __future__ import annotations
import omni.appwindow._appwindow
import typing
import carb._carb
import carb.events._events
__all__ = [
"IAppWindow",
"IAppWindowFactory",
"POSITION_CENTERED",
"POSITION_UNSET",
"WindowType",
"acquire_app_window_factory_interface",
"get_default_app_window"
]
class IAppWindow():
def broadcast_input_blocking_state(self, arg0: bool) -> None: ...
def get_action_mapping_set_path(self) -> str: ...
def get_clipboard(self) -> str: ...
def get_cursor_blink(self) -> bool: ...
def get_dpi_scale(self) -> float: ...
def get_dpi_scale_override(self) -> float: ...
@staticmethod
def get_gamepad(*args, **kwargs) -> typing.Any: ...
def get_height(self) -> int: ...
@staticmethod
def get_input_blocking_state(*args, **kwargs) -> typing.Any: ...
@staticmethod
def get_keyboard(*args, **kwargs) -> typing.Any: ...
@staticmethod
def get_mouse(*args, **kwargs) -> typing.Any: ...
def get_position(self) -> carb._carb.Int2: ...
def get_size(self) -> carb._carb.Uint2: ...
def get_title(self) -> str: ...
def get_ui_scale(self) -> float: ...
def get_width(self) -> int: ...
@staticmethod
def get_window(*args, **kwargs) -> typing.Any: ...
def get_window_close_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_content_scale_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_drop_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_focus_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_minimize_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_move_event_stream(self) -> carb.events._events.IEventStream: ...
def get_window_resize_event_stream(self) -> carb.events._events.IEventStream: ...
def is_fullscreen(self) -> bool: ...
def is_maximized(self) -> bool: ...
def maximize_window(self) -> None: ...
def move(self, arg0: int, arg1: int) -> None: ...
def resize(self, arg0: int, arg1: int) -> None: ...
def restore_window(self) -> None: ...
def set_clipboard(self, arg0: str) -> None: ...
def set_dpi_scale_override(self, arg0: float) -> None: ...
def set_fullscreen(self, arg0: bool) -> None: ...
@staticmethod
def set_input_blocking_state(*args, **kwargs) -> typing.Any: ...
def shutdown(self) -> bool: ...
def startup(self, name: str = '') -> bool: ...
def startup_with_desc(self, title: str, width: int, height: int, x: int = 18446744073709551614, y: int = 18446744073709551614, decorations: bool = True, resize: bool = True, always_on_top: bool = False, scale_to_monitor: bool = True, dpi_scale_override: float = -1.0, cursor_blink: bool = True) -> None: ...
def update(self, arg0: float) -> None: ...
@property
def ui_scale_multiplier(self) -> float:
"""
:type: float
"""
@ui_scale_multiplier.setter
def ui_scale_multiplier(self, arg1: float) -> None:
pass
pass
class IAppWindowFactory():
def create_window_by_type(self, arg0: WindowType) -> IAppWindow: ...
def create_window_from_settings(self) -> IAppWindow: ...
def create_window_ptr_by_type(self, arg0: WindowType) -> IAppWindow: ...
def create_window_ptr_from_settings(self) -> IAppWindow: ...
def destroy_window_ptr(self, arg0: IAppWindow) -> None: ...
def get_app_window(self) -> IAppWindow: ...
def get_default_window(self) -> IAppWindow: ...
def get_window_at(self, arg0: int) -> IAppWindow: ...
def get_window_count(self) -> int: ...
def get_windows(self) -> tuple: ...
def set_default_window(self, arg0: IAppWindow) -> None: ...
pass
class WindowType():
"""
Members:
OS
VIRTUAL
"""
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ...
def __init__(self, value: int) -> None: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __repr__(self) -> str: ...
def __setstate__(self, state: int) -> None: ...
@property
def name(self) -> str:
"""
:type: str
"""
@property
def value(self) -> int:
"""
:type: int
"""
OS: omni.appwindow._appwindow.WindowType # value = <WindowType.OS: 1>
VIRTUAL: omni.appwindow._appwindow.WindowType # value = <WindowType.VIRTUAL: 0>
__members__: dict # value = {'OS': <WindowType.OS: 1>, 'VIRTUAL': <WindowType.VIRTUAL: 0>}
pass
def acquire_app_window_factory_interface(*args, **kwargs) -> typing.Any:
pass
def get_default_app_window(*args, **kwargs) -> typing.Any:
pass
POSITION_CENTERED = 18446744073709551615
POSITION_UNSET = 18446744073709551614
| 4,864 | unknown | 38.877049 | 311 | 0.609581 |
omniverse-code/kit/exts/omni.appwindow/omni/appwindow/tests/test_appwindow.py | import omni.kit.app
import omni.kit.test
import carb.windowing
import carb.settings
import omni.appwindow
WINDOW_ENABLED_PATH = "/app/window/enabled"
LINUX_WM_LATENCY_MAX = 100
class Test(omni.kit.test.AsyncTestCase):
async def setUp(self):
self._windowing = carb.windowing.acquire_windowing_interface()
self._app_window_factory = omni.appwindow.acquire_app_window_factory_interface()
self._settings = carb.settings.acquire_settings_interface()
async def tearDown(self):
self._app_window_factory = None
def _cmp_vectors_and_delta(self, vec_result, vec_base, delta):
return (vec_result[0] == vec_base[0] + delta[0]) and (vec_result[1] == vec_base[1] + delta[1])
async def test_create_os_window(self):
self._app_window = self._app_window_factory.create_window_from_settings()
self._app_window.startup_with_desc(
title="Test OS window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window = self._app_window.get_window()
self.assertNotEqual(self._native_app_window, None)
self._windowing.show_window(self._native_app_window)
await omni.kit.app.get_app().next_update_async()
self._app_window.shutdown()
self._app_window = None
async def test_create_virtual_window(self):
is_window_enabled = self._settings.get(WINDOW_ENABLED_PATH)
self._settings.set(WINDOW_ENABLED_PATH, False)
self._app_window = self._app_window_factory.create_window_from_settings()
self._app_window.startup_with_desc(
title="Test virtual window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window = self._app_window.get_window()
self.assertEqual(self._native_app_window, None)
await omni.kit.app.get_app().next_update_async()
self._app_window.shutdown()
self._app_window = None
self._settings.set(WINDOW_ENABLED_PATH, is_window_enabled)
async def test_move_os_window(self):
self._app_window = self._app_window_factory.create_window_from_settings()
self._app_window.startup_with_desc(
title="Test OS window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window = self._app_window.get_window()
self.assertNotEqual(self._native_app_window, None)
self._windowing.show_window(self._native_app_window)
move_delta = [10, 20]
pos = self._app_window.get_position()
pos_native = self._windowing.get_window_position(self._native_app_window)
self.assertEqual(pos_native[0], pos[0])
self.assertEqual(pos_native[1], pos[1])
self._app_window.move(pos[0] + move_delta[0], pos[1] + move_delta[1])
for i in range(LINUX_WM_LATENCY_MAX):
await omni.kit.app.get_app().next_update_async()
# This code is needed due to Linux WM latency; window operations do not happen
# immediately, and not deterministically
new_pos = self._app_window.get_position()
move_happened = self._cmp_vectors_and_delta(new_pos, pos, move_delta)
if move_happened:
break
new_pos = self._app_window.get_position()
new_pos_native = self._windowing.get_window_position(self._native_app_window)
self.assertEqual(new_pos[0], pos[0] + move_delta[0])
self.assertEqual(new_pos[1], pos[1] + move_delta[1])
self.assertEqual(new_pos_native[0], new_pos[0])
self.assertEqual(new_pos_native[1], new_pos[1])
self._app_window.shutdown()
self._app_window = None
async def test_resize_os_window(self):
self._app_window = self._app_window_factory.create_window_from_settings()
self._app_window.startup_with_desc(
title="Test OS window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window = self._app_window.get_window()
self.assertNotEqual(self._native_app_window, None)
self._windowing.show_window(self._native_app_window)
resize_delta = [10, 20]
size = self._app_window.get_size()
size_native = [self._windowing.get_window_width(self._native_app_window), self._windowing.get_window_height(self._native_app_window)]
self.assertEqual(size_native[0], size[0])
self.assertEqual(size_native[1], size[1])
self._app_window.resize(size[0] + resize_delta[0], size[1] + resize_delta[1])
for i in range(LINUX_WM_LATENCY_MAX):
await omni.kit.app.get_app().next_update_async()
# This code is needed due to Linux WM latency; window operations do not happen
# immediately, and not deterministically
new_size = self._app_window.get_size()
resize_happened = self._cmp_vectors_and_delta(new_size, size, resize_delta)
if resize_happened:
break
new_size = self._app_window.get_size()
new_size_native = [self._windowing.get_window_width(self._native_app_window), self._windowing.get_window_height(self._native_app_window)]
self.assertEqual(new_size[0], size[0] + resize_delta[0])
self.assertEqual(new_size[1], size[1] + resize_delta[1])
self.assertEqual(new_size_native[0], new_size[0])
self.assertEqual(new_size_native[1], new_size[1])
self._app_window.shutdown()
self._app_window = None
async def test_multiple_os_windows(self):
self._app_window1 = self._app_window_factory.create_window_from_settings()
self._app_window1.startup_with_desc(
title="Test OS window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window1 = self._app_window1.get_window()
self.assertNotEqual(self._native_app_window1, None)
self._windowing.show_window(self._native_app_window1)
self._app_window2 = self._app_window_factory.create_window_from_settings()
self._app_window2.startup_with_desc(
title="Test OS window",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0
)
self._native_app_window2 = self._app_window2.get_window()
self.assertNotEqual(self._native_app_window2, None)
self._windowing.show_window(self._native_app_window2)
resize_delta = [30, 40]
size = self._app_window1.get_size()
size_native = [self._windowing.get_window_width(self._native_app_window1), self._windowing.get_window_height(self._native_app_window1)]
self.assertEqual(size_native[0], size[0])
self.assertEqual(size_native[1], size[1])
move_delta = [50, 60]
pos = self._app_window2.get_position()
pos_native = self._windowing.get_window_position(self._native_app_window2)
self.assertEqual(pos_native[0], pos[0])
self.assertEqual(pos_native[1], pos[1])
self._app_window1.resize(size[0] + resize_delta[0], size[1] + resize_delta[1])
self._app_window2.move(pos[0] + move_delta[0], pos[1] + move_delta[1])
for i in range(LINUX_WM_LATENCY_MAX):
await omni.kit.app.get_app().next_update_async()
# This code is needed due to Linux WM latency; window operations do not happen
# immediately, and not deterministically
new_size = self._app_window1.get_size()
new_pos = self._app_window2.get_position()
resize_happened = self._cmp_vectors_and_delta(new_size, size, resize_delta)
move_happened = self._cmp_vectors_and_delta(new_pos, pos, move_delta)
if resize_happened and move_happened:
break
new_size = self._app_window1.get_size()
new_size_native = [self._windowing.get_window_width(self._native_app_window1), self._windowing.get_window_height(self._native_app_window1)]
self.assertEqual(new_size[0], size[0] + resize_delta[0])
self.assertEqual(new_size[1], size[1] + resize_delta[1])
self.assertEqual(new_size_native[0], new_size[0])
self.assertEqual(new_size_native[1], new_size[1])
new_pos = self._app_window2.get_position()
new_pos_native = self._windowing.get_window_position(self._native_app_window2)
self.assertEqual(new_pos[0], pos[0] + move_delta[0])
self.assertEqual(new_pos[1], pos[1] + move_delta[1])
self.assertEqual(new_pos_native[0], new_pos[0])
self.assertEqual(new_pos_native[1], new_pos[1])
self._app_window1.shutdown()
self._app_window2.shutdown()
self._app_window1 = None
self._app_window2 = None
async def test_create_no_cursor_blink_window(self):
self._app_window = self._app_window_factory.create_window_from_settings()
self._app_window.startup_with_desc(
title="Test window, no cursor blink set",
width=100,
height=100,
x=omni.appwindow.POSITION_CENTERED,
y=omni.appwindow.POSITION_CENTERED,
decorations=True,
resize=True,
always_on_top=False,
scale_to_monitor=False,
dpi_scale_override=-1.0,
cursor_blink=False
)
self._native_app_window = self._app_window.get_window()
self.assertNotEqual(self._native_app_window, None)
self._windowing.show_window(self._native_app_window)
await omni.kit.app.get_app().next_update_async()
self.assertFalse(self._app_window.get_cursor_blink())
self._app_window.shutdown()
self._app_window = None
| 11,127 | Python | 40.992453 | 147 | 0.609329 |
omniverse-code/kit/exts/omni.appwindow/omni/appwindow/tests/__init__.py | from .test_appwindow import *
| 30 | Python | 14.499993 | 29 | 0.766667 |
omniverse-code/kit/exts/omni.kit.window.stage/PACKAGE-LICENSES/omni.kit.window.stage-LICENSE.md | Copyright (c) 2020, 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. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
omniverse-code/kit/exts/omni.kit.window.stage/config/extension.toml | [package]
title = "Kit Stage Window"
description = "Omniverse Kit Stage Window"
version = "2.3.12"
category = "Internal"
feature = true
authors = ["NVIDIA"]
repository = ""
keywords = ["stage", "outliner", "scene"]
changelog = "docs/CHANGELOG.md"
[dependencies]
"omni.ui" = {}
"omni.usd" = {}
"omni.kit.widget.stage" = {}
"omni.kit.widget.stage_icons" = {}
"omni.kit.window.drop_support" = {}
"omni.kit.menu.utils" = {}
[[python.module]]
name = "omni.kit.window.stage"
# Additional python module with tests, to make them discoverable by test system.
[[python.module]]
name = "omni.kit.window.stage.tests"
[[test]]
args = [
"--/app/window/dpiScaleOverride=1.0",
"--/app/window/scaleToMonitor=false",
"--no-window"
]
dependencies = [
"omni.kit.mainwindow",
"omni.kit.renderer.capture",
"omni.kit.ui_test"
]
| 834 | TOML | 20.410256 | 80 | 0.659472 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/stage_extension.py | # Copyright (c) 2018-2020, 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.
#
__all__ = ["StageExtension"]
import asyncio
import omni.ext
import omni.kit.ui
import omni.ui as ui
from omni.kit.menu.utils import MenuItemDescription
from .stage_window import StageWindow
class StageExtension(omni.ext.IExt):
"""The entry point for Stage Window"""
WINDOW_NAME = "Stage"
MENU_GROUP = "Window"
def on_startup(self):
self._window = None
ui.Workspace.set_show_window_fn(StageExtension.WINDOW_NAME, self.show_window)
self._menu = [MenuItemDescription(
name=StageExtension.WINDOW_NAME,
ticked=True, # menu item is ticked
ticked_fn=self._is_visible, # gets called when the menu needs to get the state of the ticked menu
onclick_fn=self._toggle_window
)]
omni.kit.menu.utils.add_menu_items(self._menu, name=StageExtension.MENU_GROUP)
ui.Workspace.show_window(StageExtension.WINDOW_NAME)
def on_shutdown(self):
omni.kit.menu.utils.remove_menu_items(self._menu, name=StageExtension.MENU_GROUP)
self._menu = None
if self._window:
self._window.destroy()
self._window = None
ui.Workspace.set_show_window_fn(StageExtension.WINDOW_NAME, None)
def _set_menu(self, value):
"""Set the menu to create this window on and off"""
# this only tags test menu to update when menu is opening, so it
# doesn't matter that is called before window has been destroyed
omni.kit.menu.utils.refresh_menu_items(StageExtension.MENU_GROUP)
async def _destroy_window_async(self):
# wait one frame, this is due to the one frame defer
# in Window::_moveToMainOSWindow()
await omni.kit.app.get_app().next_update_async()
if self._window:
self._window.destroy()
self._window = None
def _visiblity_changed_fn(self, visible):
self._set_menu(visible)
if not visible:
# Destroy the window, since we are creating new window
# in show_window
asyncio.ensure_future(self._destroy_window_async())
def show_window(self, value):
if value:
self._window = StageWindow()
self._window.set_visibility_changed_listener(self._visiblity_changed_fn)
elif self._window:
self._window.visible = False
def _is_visible(self) -> bool:
return False if self._window is None else self._window.visible
def _toggle_window(self):
if self._is_visible():
self.show_window(False)
else:
self.show_window(True)
| 3,049 | Python | 35.309523 | 109 | 0.654969 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/external_drag_drop_helper.py | import omni.ui as ui
from typing import List
from pxr import Sdf
from omni.kit.window.drop_support import ExternalDragDrop
external_drag_drop = None
def setup_external_drag_drop(window_name :str, stage_widget):
global external_drag_drop
destroy_external_drag_drop()
external_drag_drop = ExternalDragDrop(window_name=window_name,
drag_drop_fn=lambda e, p, m=stage_widget.get_model(): _on_ext_drag_drop(e, p, m))
def destroy_external_drag_drop():
global external_drag_drop
if external_drag_drop:
external_drag_drop.destroy()
external_drag_drop = None
def _on_ext_drag_drop(edd: ExternalDragDrop, payload: List[str], model: ui.AbstractItemModel):
import omni.usd
default_prim_path = Sdf.Path("/")
stage = omni.usd.get_context().get_stage()
if stage.HasDefaultPrim():
default_prim_path = stage.GetDefaultPrim().GetPath()
target_item = model.find(default_prim_path)
for file_path in edd.expand_payload(payload):
model.drop(target_item, file_path.replace("\\", "/"))
| 1,088 | Python | 31.029411 | 123 | 0.674632 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/selection_watch.py | # Copyright (c) 2018-2020, 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.
#
# Selection Watch implementation has been moved omni.kit.widget.stage.
# Import it here for keeping back compatibility.
from omni.kit.widget.stage import DefaultSelectionWatch as SelectionWatch
| 627 | Python | 51.333329 | 76 | 0.816587 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/__init__.py | # Copyright (c) 2018-2020, 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.
#
from .stage_extension import StageExtension
| 478 | Python | 42.545451 | 76 | 0.811715 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/stage_window.py | # Copyright (c) 2018-2020, 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.
#
__all__ = ["StageWindow"]
from .selection_watch import SelectionWatch
from .external_drag_drop_helper import setup_external_drag_drop, destroy_external_drag_drop
from .stage_settings import StageSettings
from omni.kit.widget.stage import StageWidget
from typing import List
from typing import Optional
from typing import Tuple
from pxr import Usd
import carb.events
import carb.settings
import omni.ui as ui
import omni.usd
class CustomizedStageWidget(StageWidget):
@StageWidget.show_prim_display_name.setter
def show_prim_display_name(self, value):
StageWidget.show_prim_display_name.fset(self, value)
StageSettings().show_prim_displayname = value
@StageWidget.children_reorder_supported.setter
def children_reorder_supported(self, value):
StageWidget.children_reorder_supported.fset(self, value)
StageSettings().should_keep_children_order = value
@StageWidget.auto_reload_prims.setter
def auto_reload_prims(self, value):
StageWidget.auto_reload_prims.fset(self, value)
StageSettings().auto_reload_prims = value
def get_treeview(self):
return self._tree_view
def get_delegate(self):
return self._delegate
class StageWindow(ui.Window):
"""The Stage window"""
def __init__(self, usd_context_name: str = ""):
self._usd_context = omni.usd.get_context(usd_context_name)
self._visiblity_changed_listener = None
super().__init__(
"Stage",
width=600,
height=800,
flags=ui.WINDOW_FLAGS_NO_SCROLLBAR,
dockPreference=ui.DockPreference.RIGHT_TOP,
)
self.set_visibility_changed_fn(self._visibility_changed_fn)
# Dock it to the same space where Layers is docked, make it the first tab and the active tab.
self.deferred_dock_in("Layers", ui.DockPolicy.CURRENT_WINDOW_IS_ACTIVE)
self.dock_order = 0
# Get list of columns from settings
self._settings = carb.settings.get_settings()
self._columns_settings_path = "/persistent/exts/omni.kit.window.stage/columns"
columns: Optional[str] = self._settings.get(self._columns_settings_path)
if columns is None:
# By default Visibility and Type are enabled columns
self._columns = ["Visibility","Type"]
else:
self._columns = columns.split("|")
with self.frame:
self._stage_widget = CustomizedStageWidget(
None, columns_enabled=self._columns,
children_reorder_supported=StageSettings().should_keep_children_order,
show_prim_display_name=StageSettings().show_prim_displayname,
auto_reload_prims=StageSettings().auto_reload_prims
)
# The Open/Close Stage logic
self._stage_subscription = self._usd_context.get_stage_event_stream().create_subscription_to_pop(
self._on_usd_context_event, name="Stage Window USD Stage Open/Closing Listening"
)
self._on_stage_opened()
# The selection logic
self._selection = SelectionWatch(usd_context=self._usd_context)
self._stage_widget.set_selection_watch(self._selection)
# Callback when columns are changed or toggled
self._columns_changed_sub = self._stage_widget.subscribe_columns_changed(self._columns_changed)
def _columns_changed(self, columns: List[Tuple[str, bool]]):
"""
Called by StageWidget when columns are changed or toggled.
"""
enabled_columns = [c[0] for c in columns if c[1]]
self._settings.set_string(self._columns_settings_path, "|".join(enabled_columns))
def _visibility_changed_fn(self, visible):
if self._visiblity_changed_listener:
self._visiblity_changed_listener(visible)
if not visible:
if self._selection:
self._selection.destroy()
self._selection = None
else:
self._selection = SelectionWatch(usd_context=self._usd_context)
if self._stage_widget:
self._stage_widget.set_selection_watch(self._selection)
def set_visibility_changed_listener(self, listener):
self._visiblity_changed_listener = listener
def destroy(self):
"""
Called by extension before destroying this object. It doesn't happen automatically.
Without this hot reloading doesn't work.
"""
self._visiblity_changed_listener = None
if self._selection:
self._selection._tree_view = None
self._selection._events = None
self._selection._stage_event_sub = None
self._selection = None
self._stage_widget.destroy()
self._stage_widget = None
self._stage_subscription = None
self._settings = None
self._columns_changed_sub = None
super().destroy()
destroy_external_drag_drop()
def _on_usd_context_event(self, event: carb.events.IEvent):
"""Called on USD Context event"""
if event.type == int(omni.usd.StageEventType.OPENED):
self._on_stage_opened()
elif event.type == int(omni.usd.StageEventType.CLOSING):
self._on_stage_closing()
def _on_stage_opened(self):
"""Called when opening a new stage"""
stage = self._usd_context.get_stage()
if not stage:
return
self._stage_widget.open_stage(stage)
setup_external_drag_drop("Stage", self._stage_widget)
def _on_stage_closing(self):
"""Called when close the stage"""
self._stage_widget.open_stage(None)
setup_external_drag_drop("Stage", self._stage_widget)
def get_widget(self) -> CustomizedStageWidget:
return self._stage_widget
| 6,244 | Python | 36.172619 | 105 | 0.653107 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/stage_settings.py | # Copyright (c) 2018-2020, 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.
#
# Selection Watch implementation has been moved omni.kit.widget.stage.
# Import it here for keeping back compatibility.
import carb.settings
import omni.kit.usd.layers as layers
from .singleton import Singleton
SETTINGS_SHOW_PRIM_DISPLAYNAME = "/persistent/ext/omni.kit.widget.stage/show_prim_displayname"
SETTINGS_KEEP_CHILDREN_ORDER = "/persistent/ext/omni.usd/keep_children_order"
@Singleton
class StageSettings:
def __init__(self):
super().__init__()
self._settings = carb.settings.get_settings()
self._settings.set_default_bool(SETTINGS_SHOW_PRIM_DISPLAYNAME, False)
self._settings.set_default_bool(layers.SETTINGS_AUTO_RELOAD_NON_SUBLAYERS, False)
self._settings.set_default_bool(SETTINGS_KEEP_CHILDREN_ORDER, False)
@property
def show_prim_displayname(self):
return self._settings.get_as_bool(SETTINGS_SHOW_PRIM_DISPLAYNAME)
@show_prim_displayname.setter
def show_prim_displayname(self, enabled: bool):
self._settings.set(SETTINGS_SHOW_PRIM_DISPLAYNAME, enabled)
@property
def auto_reload_prims(self):
return self._settings.get_as_bool(layers.SETTINGS_AUTO_RELOAD_NON_SUBLAYERS)
@auto_reload_prims.setter
def auto_reload_prims(self, enabled: bool):
self._settings.set(layers.SETTINGS_AUTO_RELOAD_NON_SUBLAYERS, enabled)
@property
def should_keep_children_order(self):
return self._settings.get_as_bool(SETTINGS_KEEP_CHILDREN_ORDER)
@should_keep_children_order.setter
def should_keep_children_order(self, value):
self._settings.set(SETTINGS_KEEP_CHILDREN_ORDER, value)
| 2,068 | Python | 37.314814 | 94 | 0.738878 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/singleton.py | # Copyright (c) 2018-2020, 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.
#
def Singleton(class_):
"""A singleton decorator"""
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]
return getinstance
| 697 | Python | 32.238094 | 76 | 0.725968 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/tests/__init__.py | # Copyright (c) 2018-2020, 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.
#
from .stage_window_test import TestStageWindow
| 480 | Python | 47.099995 | 76 | 0.8125 |
omniverse-code/kit/exts/omni.kit.window.stage/omni/kit/window/stage/tests/stage_window_test.py | ## 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.
##
import omni.kit.test
from omni.ui.tests.test_base import OmniUiTest
from pathlib import Path
import carb
import omni.kit.app
import omni.ui as ui
import omni.usd
import omni.kit.commands
from omni.kit import ui_test
from unittest.mock import Mock, patch, ANY
from ..stage_window import StageWindow
CURRENT_PATH = Path(__file__).parent.joinpath("../../../../../data")
class TestStageWindow(OmniUiTest):
# Before running each test
async def setUp(self):
await super().setUp()
self._golden_img_dir = CURRENT_PATH.absolute().resolve().joinpath("tests")
self._w = ui.Workspace.get_window("Stage")
self._usd_context = omni.usd.get_context()
# After running each test
async def tearDown(self):
self._w = None
self._golden_img_dir = None
await super().tearDown()
async def test_general(self):
# New stage with a sphere
await self._usd_context.new_stage_async()
omni.kit.commands.execute("CreatePrim", prim_path="/Sphere", prim_type="Sphere", select_new_prim=False)
# Loading icon takes time.
# TODO: We need a mode that blocks UI until icons are loaded
await self.wait(10)
await self.docked_test_window(
window=self._w,
width=450,
height=100,
restore_window=ui.Workspace.get_window("Layer"),
restore_position=ui.DockPosition.SAME,
)
await self.finalize_test(golden_img_dir=self._golden_img_dir)
async def test_multi_visibility_change(self):
"""Testing visibility of StageWidget"""
await self.docked_test_window(
window=self._w,
width=450,
height=200,
)
# New stage with three prims
await self._usd_context.new_stage_async()
omni.kit.commands.execute("CreatePrim", prim_path="/A", prim_type="Sphere", select_new_prim=False)
omni.kit.commands.execute("CreatePrim", prim_path="/B", prim_type="Sphere", select_new_prim=False)
omni.kit.commands.execute("CreatePrim", prim_path="/C", prim_type="Sphere", select_new_prim=False)
await ui_test.wait_n_updates(5)
# select both A and C
self._usd_context.get_selection().set_selected_prim_paths(["/A", "/C"], True)
# make A invisible
await ui_test.wait_n_updates(5)
stage_widget = ui_test.find("Stage//Frame/**/ScrollingFrame/TreeView[*].visible==True")
eye_icon = stage_widget.find_all("**/ToolButton[*]")[0]
await eye_icon.click()
await ui_test.wait_n_updates(5)
# check C will also be invisible
await self.finalize_test(golden_img_dir=self._golden_img_dir)
async def wait(self, n=100):
for i in range(n):
await omni.kit.app.get_app().next_update_async()
async def test_header_columns(self):
from omni.kit import ui_test
await ui_test.find("Stage").focus()
stage_widget = ui_test.find("Stage//Frame/**/ScrollingFrame/TreeView[*].visible==True")
name_column = stage_widget.find("**/Label[*].text=='Name (Old to New)'")
self.assertTrue(name_column)
await ui_test.emulate_mouse_move(name_column.center)
await name_column.right_click()
with self.assertRaises(Exception):
await ui_test.select_context_menu("Create")
await self.wait()
await name_column.click()
await self.wait()
name_column = stage_widget.find("**/Label[*].text=='Name (A to Z)'")
self.assertTrue(name_column)
await name_column.click()
await self.wait()
name_column = stage_widget.find("**/Label[*].text=='Name (Z to A)'")
self.assertTrue(name_column)
await name_column.click()
await self.wait()
name_column = stage_widget.find("**/Label[*].text=='Name (New to Old)'")
self.assertTrue(name_column)
await name_column.click()
await self.wait()
name_column = stage_widget.find("**/Label[*].text=='Name (Old to New)'")
self.assertTrue(name_column)
await self.finalize_test_no_image()
async def test_rename_with_context_menu(self):
from omni.kit import ui_test
await ui_test.find("Stage").focus()
stage_widget = ui_test.find("Stage//Frame/**/ScrollingFrame/TreeView[*].visible==True")
# New stage with three prims
await self._usd_context.new_stage_async()
stage = omni.usd.get_context().get_stage()
stage.GetRootLayer().Clear()
await ui_test.wait_n_updates(5)
prim = stage.DefinePrim("/test", "Xform")
await ui_test.wait_n_updates(5)
prim_item = stage_widget.find("**/Label[*].text=='test'")
self.assertTrue(prim_item)
prim_name_field = stage_widget.find("**/StringField[*].identifier=='rename_field'")
self.assertTrue(prim_name_field)
await prim_item.double_click()
self.assertTrue(prim_name_field.widget.selected)
prim_name_field.model.set_value("")
await prim_name_field.input("test2")
await ui_test.input.emulate_keyboard_press(carb.input.KeyboardInput.ENTER)
await ui_test.wait_n_updates(5)
old_prim = stage.GetPrimAtPath("/test")
self.assertFalse(old_prim)
new_prim = stage.GetPrimAtPath("/test2")
self.assertTrue(new_prim)
# Rename with context menu
prim_item = stage_widget.find("**/Label[*].text=='test2'")
self.assertTrue(prim_item)
prim_name_field = stage_widget.find("**/StringField[*].identifier=='rename_field'")
self.assertTrue(prim_name_field)
await prim_item.right_click()
await ui_test.select_context_menu("Rename")
self.assertTrue(prim_name_field.widget.selected)
await prim_name_field.input("test3")
await ui_test.input.emulate_keyboard_press(carb.input.KeyboardInput.ENTER)
await ui_test.wait_n_updates(5)
old_prim = stage.GetPrimAtPath("/test")
self.assertFalse(old_prim)
new_prim = stage.GetPrimAtPath("/test2test3")
self.assertTrue(new_prim)
await self.finalize_test_no_image()
async def test_window_destroyed_when_hidden(self):
"""Test that hiding stage window destroys it, and showing creates a new instance."""
ui.Workspace.show_window("Stage")
self.assertTrue(ui.Workspace.get_window("Stage").visible)
with patch.object(StageWindow, "destroy", autospec=True) as mock_destroy_dialog:
ui.Workspace.show_window("Stage", False)
await ui_test.wait_n_updates(5)
mock_destroy_dialog.assert_called()
self.assertFalse(ui.Workspace.get_window("Stage").visible)
await self.finalize_test_no_image()
| 7,238 | Python | 37.505319 | 111 | 0.63664 |
omniverse-code/kit/exts/omni.kit.window.stage/docs/CHANGELOG.md | # Changelog
## [2.3.12] - 2023-01-11
### Added
- Move SelectionWatch into omni.kit.widget.stage to provide default implementation.
## [2.3.11] - 2022-11-29
### Added
- Unitests for header of name column.
## [2.3.10] - 2022-11-01
### Added
- Test for renaming prim.
## [2.3.9] - 2022-09-30
### Fixed
- Set the menu checkbox when the window is appearing
## [2.3.8] - 2022-08-04
### Added
- Test for toggling visibility for multiple prims
## [2.3.7] - 2022-05-24
### Changed
- Optimize selection of stage window by reducing allocations of Sdf.Path.
## [2.3.6] - 2022-03-03
### Changed
- Use command for selection in widget so it can be undoable.
## [2.3.5] - 2021-10-20
### Changed
- External drag/drop doesn't use windows slashes
## [2.3.4] - 2021-05-25
### Fixed
- Bug when hide and show the Stage window
## [2.3.3] - 2021-04-27
## Removed
- `omni.stageupdate` is deprecated and doesn't work well with multiple usd
contexts
## [2.3.2] - 2020-11-19
### Changed
- Refusing selection of grayed prims in search mode
## [2.3.1] - 2020-10-22
### Added
- Dependency on omni.kit.widget.stage_icons
## [2.3.0] - 2020-09-16
### Changed
- Split to two parts: omni.kit.widget.stage and omni.kit.window.stage
## [2.2.0] - 2020-09-15
### Changed
- Detached from Editor and using UsdNotice for notifications
| 1,310 | Markdown | 21.220339 | 83 | 0.670229 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/PACKAGE-LICENSES/omni.kit.procedural.mesh-LICENSE.md | Copyright (c) 2020, 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. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/config/extension.toml |
[package]
version = "0.1.0"
title = "Procedural Mesh"
category = "Internal"
# Main module of the python interface
[[python.module]]
name = "omni.kit.procedural.mesh"
# Watch the .ogn files for hot reloading (only works for Python files)
[fswatcher.patterns]
include = ["*.ogn", "*.py"]
exclude = ["Ogn*Database.py"]
# Other extensions that must be loaded before this one
[dependencies]
"omni.usd" = {}
"omni.ui" = {}
"omni.graph" = {}
"omni.graph.tools" = {}
"omni.kit.menu.utils" = {}
[[native.plugin]]
path = "bin/*.plugin"
recursive = false
| 551 | TOML | 18.034482 | 70 | 0.669691 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/__init__.py | from .scripts.extension import *
from .scripts.command import *
| 64 | Python | 20.66666 | 32 | 0.78125 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshSphereDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshSphere
If necessary, create a new mesh representing a shpere
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshSphereDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshSphere
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.diameter
inputs.latitudeResolution
inputs.longitudeResolution
inputs.parameterCheck
Outputs:
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:diameter', 'float', 0, None, 'Sphere diameter', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:latitudeResolution', 'int', 0, None, 'Sphere Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:longitudeResolution', 'int', 0, None, 'Sphere Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"diameter", "latitudeResolution", "longitudeResolution", "parameterCheck", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.diameter, self._attributes.latitudeResolution, self._attributes.longitudeResolution, self._attributes.parameterCheck]
self._batchedReadValues = [100, 10, 10, -1]
@property
def diameter(self):
return self._batchedReadValues[0]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[0] = value
@property
def latitudeResolution(self):
return self._batchedReadValues[1]
@latitudeResolution.setter
def latitudeResolution(self, value):
self._batchedReadValues[1] = value
@property
def longitudeResolution(self):
return self._batchedReadValues[2]
@longitudeResolution.setter
def longitudeResolution(self, value):
self._batchedReadValues[2] = value
@property
def parameterCheck(self):
return self._batchedReadValues[3]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[3] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshSphereDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshSphereDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshSphereDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 10,957 | Python | 46.030043 | 177 | 0.637127 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshCubeDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCube
If necessary, create a new mesh representing a cube
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshCubeDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCube
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.parameterCheck
inputs.xLength
inputs.xResolution
inputs.yLength
inputs.yResolution
inputs.zLength
inputs.zResolution
Outputs:
outputs.creaseIndices
outputs.creaseLengths
outputs.creaseSharpnesses
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.normalIndices
outputs.normals
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('inputs:xLength', 'float', 0, None, 'Cube x extent', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:xResolution', 'int', 0, None, 'Cube Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:yLength', 'float', 0, None, 'Cube y extent', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:yResolution', 'int', 0, None, 'Cube Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:zLength', 'float', 0, None, 'Cube z extent', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:zResolution', 'int', 0, None, 'Cube Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('outputs:creaseIndices', 'int[]', 0, None, "Crease vertices's indices, one crease after another", {}, True, None, False, ''),
('outputs:creaseLengths', 'int[]', 0, None, 'Number of vertices of creases', {}, True, None, False, ''),
('outputs:creaseSharpnesses', 'float[]', 0, None, 'Sharpness of creases', {}, True, None, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:normalIndices', 'int[]', 0, None, 'Normal indices of faces', {}, True, None, False, ''),
('outputs:normals', 'float3[]', 0, None, 'Normal of vertices', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "xLength", "xResolution", "yLength", "yResolution", "zLength", "zResolution", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.parameterCheck, self._attributes.xLength, self._attributes.xResolution, self._attributes.yLength, self._attributes.yResolution, self._attributes.zLength, self._attributes.zResolution]
self._batchedReadValues = [-1, 100, 10, 100, 10, 100, 10]
@property
def parameterCheck(self):
return self._batchedReadValues[0]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[0] = value
@property
def xLength(self):
return self._batchedReadValues[1]
@xLength.setter
def xLength(self, value):
self._batchedReadValues[1] = value
@property
def xResolution(self):
return self._batchedReadValues[2]
@xResolution.setter
def xResolution(self, value):
self._batchedReadValues[2] = value
@property
def yLength(self):
return self._batchedReadValues[3]
@yLength.setter
def yLength(self, value):
self._batchedReadValues[3] = value
@property
def yResolution(self):
return self._batchedReadValues[4]
@yResolution.setter
def yResolution(self, value):
self._batchedReadValues[4] = value
@property
def zLength(self):
return self._batchedReadValues[5]
@zLength.setter
def zLength(self, value):
self._batchedReadValues[5] = value
@property
def zResolution(self):
return self._batchedReadValues[6]
@zResolution.setter
def zResolution(self, value):
self._batchedReadValues[6] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.creaseIndices_size = None
self.creaseLengths_size = None
self.creaseSharpnesses_size = None
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.normalIndices_size = None
self.normals_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def creaseIndices(self):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
return data_view.get(reserved_element_count=self.creaseIndices_size)
@creaseIndices.setter
def creaseIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
data_view.set(value)
self.creaseIndices_size = data_view.get_array_size()
@property
def creaseLengths(self):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
return data_view.get(reserved_element_count=self.creaseLengths_size)
@creaseLengths.setter
def creaseLengths(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
data_view.set(value)
self.creaseLengths_size = data_view.get_array_size()
@property
def creaseSharpnesses(self):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
return data_view.get(reserved_element_count=self.creaseSharpnesses_size)
@creaseSharpnesses.setter
def creaseSharpnesses(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
data_view.set(value)
self.creaseSharpnesses_size = data_view.get_array_size()
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def normalIndices(self):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
return data_view.get(reserved_element_count=self.normalIndices_size)
@normalIndices.setter
def normalIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
data_view.set(value)
self.normalIndices_size = data_view.get_array_size()
@property
def normals(self):
data_view = og.AttributeValueHelper(self._attributes.normals)
return data_view.get(reserved_element_count=self.normals_size)
@normals.setter
def normals(self, value):
data_view = og.AttributeValueHelper(self._attributes.normals)
data_view.set(value)
self.normals_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshCubeDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshCubeDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshCubeDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 15,252 | Python | 44.804805 | 243 | 0.628639 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshPlaneDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshPlane
If necessary, create a new mesh representing a plane
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshPlaneDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshPlane
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.parameterCheck
inputs.xLength
inputs.xResolution
inputs.zLength
inputs.zResolution
Outputs:
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.parameterCheck
outputs.points
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('inputs:xLength', 'float', 0, None, 'Plane x extent', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:xResolution', 'int', 0, None, 'Plane Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:zLength', 'float', 0, None, 'Plane z extent', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:zResolution', 'int', 0, None, 'Plane Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('outputs:extent', 'point3f[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'point3f[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:sts', 'texCoord2f[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.outputs.extent = og.Database.ROLE_POINT
role_data.outputs.points = og.Database.ROLE_POINT
role_data.outputs.sts = og.Database.ROLE_TEXCOORD
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "xLength", "xResolution", "zLength", "zResolution", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.parameterCheck, self._attributes.xLength, self._attributes.xResolution, self._attributes.zLength, self._attributes.zResolution]
self._batchedReadValues = [-1, 100, 10, 100, 10]
@property
def parameterCheck(self):
return self._batchedReadValues[0]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[0] = value
@property
def xLength(self):
return self._batchedReadValues[1]
@xLength.setter
def xLength(self, value):
self._batchedReadValues[1] = value
@property
def xResolution(self):
return self._batchedReadValues[2]
@xResolution.setter
def xResolution(self, value):
self._batchedReadValues[2] = value
@property
def zLength(self):
return self._batchedReadValues[3]
@zLength.setter
def zLength(self, value):
self._batchedReadValues[3] = value
@property
def zResolution(self):
return self._batchedReadValues[4]
@zResolution.setter
def zResolution(self, value):
self._batchedReadValues[4] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.points_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshPlaneDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshPlaneDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshPlaneDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 10,996 | Python | 45.400844 | 187 | 0.633412 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshConeDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCone
If necessary, create a new mesh representing a Cone
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshConeDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCone
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.capResolution
inputs.diameter
inputs.height
inputs.latitudeResolution
inputs.longitudeResolution
inputs.parameterCheck
Outputs:
outputs.cornerIndices
outputs.cornerSharpnesses
outputs.creaseIndices
outputs.creaseLengths
outputs.creaseSharpnesses
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.normalIndices
outputs.normals
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:capResolution', 'int', 0, None, 'Cone Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:diameter', 'float', 0, None, 'Cone diameter', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:height', 'float', 0, None, 'Cone height', {ogn.MetadataKeys.DEFAULT: '200'}, True, 200, False, ''),
('inputs:latitudeResolution', 'int', 0, None, 'Cone Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:longitudeResolution', 'int', 0, None, 'Cone Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('outputs:cornerIndices', 'int[]', 0, None, "Corner vertices's indices", {}, True, None, False, ''),
('outputs:cornerSharpnesses', 'float[]', 0, None, "Corner vertices's sharpness values", {}, True, None, False, ''),
('outputs:creaseIndices', 'int[]', 0, None, "Crease vertices's indices, one crease after another", {}, True, None, False, ''),
('outputs:creaseLengths', 'int[]', 0, None, 'Number of vertices of creases', {}, True, None, False, ''),
('outputs:creaseSharpnesses', 'float[]', 0, None, 'Sharpness of creases', {}, True, None, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:normalIndices', 'int[]', 0, None, 'Normal indices of faces', {}, True, None, False, ''),
('outputs:normals', 'float3[]', 0, None, 'Normal of vertices', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"capResolution", "diameter", "height", "latitudeResolution", "longitudeResolution", "parameterCheck", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.capResolution, self._attributes.diameter, self._attributes.height, self._attributes.latitudeResolution, self._attributes.longitudeResolution, self._attributes.parameterCheck]
self._batchedReadValues = [10, 100, 200, 10, 10, -1]
@property
def capResolution(self):
return self._batchedReadValues[0]
@capResolution.setter
def capResolution(self, value):
self._batchedReadValues[0] = value
@property
def diameter(self):
return self._batchedReadValues[1]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[1] = value
@property
def height(self):
return self._batchedReadValues[2]
@height.setter
def height(self, value):
self._batchedReadValues[2] = value
@property
def latitudeResolution(self):
return self._batchedReadValues[3]
@latitudeResolution.setter
def latitudeResolution(self, value):
self._batchedReadValues[3] = value
@property
def longitudeResolution(self):
return self._batchedReadValues[4]
@longitudeResolution.setter
def longitudeResolution(self, value):
self._batchedReadValues[4] = value
@property
def parameterCheck(self):
return self._batchedReadValues[5]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[5] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.cornerIndices_size = None
self.cornerSharpnesses_size = None
self.creaseIndices_size = None
self.creaseLengths_size = None
self.creaseSharpnesses_size = None
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.normalIndices_size = None
self.normals_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def cornerIndices(self):
data_view = og.AttributeValueHelper(self._attributes.cornerIndices)
return data_view.get(reserved_element_count=self.cornerIndices_size)
@cornerIndices.setter
def cornerIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.cornerIndices)
data_view.set(value)
self.cornerIndices_size = data_view.get_array_size()
@property
def cornerSharpnesses(self):
data_view = og.AttributeValueHelper(self._attributes.cornerSharpnesses)
return data_view.get(reserved_element_count=self.cornerSharpnesses_size)
@cornerSharpnesses.setter
def cornerSharpnesses(self, value):
data_view = og.AttributeValueHelper(self._attributes.cornerSharpnesses)
data_view.set(value)
self.cornerSharpnesses_size = data_view.get_array_size()
@property
def creaseIndices(self):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
return data_view.get(reserved_element_count=self.creaseIndices_size)
@creaseIndices.setter
def creaseIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
data_view.set(value)
self.creaseIndices_size = data_view.get_array_size()
@property
def creaseLengths(self):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
return data_view.get(reserved_element_count=self.creaseLengths_size)
@creaseLengths.setter
def creaseLengths(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
data_view.set(value)
self.creaseLengths_size = data_view.get_array_size()
@property
def creaseSharpnesses(self):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
return data_view.get(reserved_element_count=self.creaseSharpnesses_size)
@creaseSharpnesses.setter
def creaseSharpnesses(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
data_view.set(value)
self.creaseSharpnesses_size = data_view.get_array_size()
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def normalIndices(self):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
return data_view.get(reserved_element_count=self.normalIndices_size)
@normalIndices.setter
def normalIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
data_view.set(value)
self.normalIndices_size = data_view.get_array_size()
@property
def normals(self):
data_view = og.AttributeValueHelper(self._attributes.normals)
return data_view.get(reserved_element_count=self.normals_size)
@normals.setter
def normals(self, value):
data_view = og.AttributeValueHelper(self._attributes.normals)
data_view.set(value)
self.normals_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshConeDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshConeDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshConeDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 16,329 | Python | 45.524216 | 234 | 0.633903 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshDiskDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshDisk
If necessary, create a new mesh representing a disk
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshDiskDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshDisk
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.capResolution
inputs.diameter
inputs.longitudeResolution
inputs.parameterCheck
Outputs:
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.parameterCheck
outputs.points
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:capResolution', 'int', 0, None, 'Disk Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:diameter', 'float', 0, None, 'Disk diameter', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:longitudeResolution', 'int', 0, None, 'Disk Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"capResolution", "diameter", "longitudeResolution", "parameterCheck", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.capResolution, self._attributes.diameter, self._attributes.longitudeResolution, self._attributes.parameterCheck]
self._batchedReadValues = [10, 100, 10, -1]
@property
def capResolution(self):
return self._batchedReadValues[0]
@capResolution.setter
def capResolution(self, value):
self._batchedReadValues[0] = value
@property
def diameter(self):
return self._batchedReadValues[1]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[1] = value
@property
def longitudeResolution(self):
return self._batchedReadValues[2]
@longitudeResolution.setter
def longitudeResolution(self, value):
self._batchedReadValues[2] = value
@property
def parameterCheck(self):
return self._batchedReadValues[3]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[3] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.points_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshDiskDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshDiskDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshDiskDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 10,284 | Python | 45.96347 | 172 | 0.636717 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshCapsuleDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCapsule
If necessary, create a new mesh representing a capsule
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshCapsuleDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCapsule
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.diameter
inputs.hemisphereLatitudeResolution
inputs.longitudeResolution
inputs.middleLatitudeResolution
inputs.parameterCheck
inputs.yLength
Outputs:
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:diameter', 'float', 0, None, 'Capsule diameter', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:hemisphereLatitudeResolution', 'int', 0, None, 'Capsule Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:longitudeResolution', 'int', 0, None, 'Capsule Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:middleLatitudeResolution', 'int', 0, None, 'Capsule Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('inputs:yLength', 'float', 0, None, 'Capsule y extent', {ogn.MetadataKeys.DEFAULT: '200'}, True, 200, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"diameter", "hemisphereLatitudeResolution", "longitudeResolution", "middleLatitudeResolution", "parameterCheck", "yLength", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.diameter, self._attributes.hemisphereLatitudeResolution, self._attributes.longitudeResolution, self._attributes.middleLatitudeResolution, self._attributes.parameterCheck, self._attributes.yLength]
self._batchedReadValues = [100, 10, 10, 10, -1, 200]
@property
def diameter(self):
return self._batchedReadValues[0]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[0] = value
@property
def hemisphereLatitudeResolution(self):
return self._batchedReadValues[1]
@hemisphereLatitudeResolution.setter
def hemisphereLatitudeResolution(self, value):
self._batchedReadValues[1] = value
@property
def longitudeResolution(self):
return self._batchedReadValues[2]
@longitudeResolution.setter
def longitudeResolution(self, value):
self._batchedReadValues[2] = value
@property
def middleLatitudeResolution(self):
return self._batchedReadValues[3]
@middleLatitudeResolution.setter
def middleLatitudeResolution(self, value):
self._batchedReadValues[3] = value
@property
def parameterCheck(self):
return self._batchedReadValues[4]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[4] = value
@property
def yLength(self):
return self._batchedReadValues[5]
@yLength.setter
def yLength(self, value):
self._batchedReadValues[5] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshCapsuleDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshCapsuleDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshCapsuleDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 11,933 | Python | 46.16996 | 256 | 0.639571 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshTorusDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshTorus
If necessary, create a new mesh representing a torus
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshTorusDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshTorus
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.diameter
inputs.loopResolution
inputs.parameterCheck
inputs.sectionDiameter
inputs.sectionResolution
inputs.sectionTwist
Outputs:
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:diameter', 'float', 0, None, 'Torus diameter', {ogn.MetadataKeys.DEFAULT: '200'}, True, 200, False, ''),
('inputs:loopResolution', 'int', 0, None, 'Torus Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('inputs:sectionDiameter', 'float', 0, None, 'Torus section diameter', {ogn.MetadataKeys.DEFAULT: '50'}, True, 50, False, ''),
('inputs:sectionResolution', 'int', 0, None, 'Torus Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:sectionTwist', 'float', 0, None, 'Torus section twist radian', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"diameter", "loopResolution", "parameterCheck", "sectionDiameter", "sectionResolution", "sectionTwist", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.diameter, self._attributes.loopResolution, self._attributes.parameterCheck, self._attributes.sectionDiameter, self._attributes.sectionResolution, self._attributes.sectionTwist]
self._batchedReadValues = [200, 10, -1, 50, 10, 0]
@property
def diameter(self):
return self._batchedReadValues[0]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[0] = value
@property
def loopResolution(self):
return self._batchedReadValues[1]
@loopResolution.setter
def loopResolution(self, value):
self._batchedReadValues[1] = value
@property
def parameterCheck(self):
return self._batchedReadValues[2]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[2] = value
@property
def sectionDiameter(self):
return self._batchedReadValues[3]
@sectionDiameter.setter
def sectionDiameter(self, value):
self._batchedReadValues[3] = value
@property
def sectionResolution(self):
return self._batchedReadValues[4]
@sectionResolution.setter
def sectionResolution(self, value):
self._batchedReadValues[4] = value
@property
def sectionTwist(self):
return self._batchedReadValues[5]
@sectionTwist.setter
def sectionTwist(self, value):
self._batchedReadValues[5] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshTorusDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshTorusDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshTorusDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 11,783 | Python | 45.577075 | 236 | 0.634813 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/OgnProceduralMeshCylinderDatabase.py | """Support for simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCylinder
If necessary, create a new mesh representing a cylinder
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
class OgnProceduralMeshCylinderDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.kit.procedural.mesh.CreateMeshCylinder
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.capResolution
inputs.diameter
inputs.height
inputs.latitudeResolution
inputs.longitudeResolution
inputs.parameterCheck
Outputs:
outputs.creaseIndices
outputs.creaseLengths
outputs.creaseSharpnesses
outputs.extent
outputs.faceVertexCounts
outputs.faceVertexIndices
outputs.normalIndices
outputs.normals
outputs.parameterCheck
outputs.points
outputs.stIndices
outputs.sts
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:capResolution', 'int', 0, None, 'Cylinder Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:diameter', 'float', 0, None, 'Cylinder diameter', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:height', 'float', 0, None, 'Cylinder height', {ogn.MetadataKeys.DEFAULT: '100'}, True, 100, False, ''),
('inputs:latitudeResolution', 'int', 0, None, 'Cylinder Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:longitudeResolution', 'int', 0, None, 'Cylinder Resolution', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''),
('inputs:parameterCheck', 'int', 0, None, 'Previous crc value', {ogn.MetadataKeys.DEFAULT: '-1'}, True, -1, False, ''),
('outputs:creaseIndices', 'int[]', 0, None, "Crease vertices's indices, one crease after another", {}, True, None, False, ''),
('outputs:creaseLengths', 'int[]', 0, None, 'Number of vertices of creases', {}, True, None, False, ''),
('outputs:creaseSharpnesses', 'float[]', 0, None, 'Sharpness of creases', {}, True, None, False, ''),
('outputs:extent', 'float3[]', 0, None, 'Extent of the mesh', {}, True, None, False, ''),
('outputs:faceVertexCounts', 'int[]', 0, None, 'Vertex count of faces', {}, True, None, False, ''),
('outputs:faceVertexIndices', 'int[]', 0, None, 'Vertex indices of faces', {}, True, None, False, ''),
('outputs:normalIndices', 'int[]', 0, None, 'Normal indices of faces', {}, True, None, False, ''),
('outputs:normals', 'float3[]', 0, None, 'Normal of vertices', {}, True, None, False, ''),
('outputs:parameterCheck', 'int', 0, None, 'Current crc value', {}, True, None, False, ''),
('outputs:points', 'float3[]', 0, None, 'Points', {}, True, None, False, ''),
('outputs:stIndices', 'int[]', 0, None, 'Texture coordinate indices of faces', {}, True, None, False, ''),
('outputs:sts', 'float2[]', 0, None, 'Texture coordinate of vertices', {}, True, None, False, ''),
])
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"capResolution", "diameter", "height", "latitudeResolution", "longitudeResolution", "parameterCheck", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.capResolution, self._attributes.diameter, self._attributes.height, self._attributes.latitudeResolution, self._attributes.longitudeResolution, self._attributes.parameterCheck]
self._batchedReadValues = [10, 100, 100, 10, 10, -1]
@property
def capResolution(self):
return self._batchedReadValues[0]
@capResolution.setter
def capResolution(self, value):
self._batchedReadValues[0] = value
@property
def diameter(self):
return self._batchedReadValues[1]
@diameter.setter
def diameter(self, value):
self._batchedReadValues[1] = value
@property
def height(self):
return self._batchedReadValues[2]
@height.setter
def height(self, value):
self._batchedReadValues[2] = value
@property
def latitudeResolution(self):
return self._batchedReadValues[3]
@latitudeResolution.setter
def latitudeResolution(self, value):
self._batchedReadValues[3] = value
@property
def longitudeResolution(self):
return self._batchedReadValues[4]
@longitudeResolution.setter
def longitudeResolution(self, value):
self._batchedReadValues[4] = value
@property
def parameterCheck(self):
return self._batchedReadValues[5]
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedReadValues[5] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"parameterCheck", "_batchedWriteValues"}
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self.creaseIndices_size = None
self.creaseLengths_size = None
self.creaseSharpnesses_size = None
self.extent_size = None
self.faceVertexCounts_size = None
self.faceVertexIndices_size = None
self.normalIndices_size = None
self.normals_size = None
self.points_size = None
self.stIndices_size = None
self.sts_size = None
self._batchedWriteValues = { }
@property
def creaseIndices(self):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
return data_view.get(reserved_element_count=self.creaseIndices_size)
@creaseIndices.setter
def creaseIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseIndices)
data_view.set(value)
self.creaseIndices_size = data_view.get_array_size()
@property
def creaseLengths(self):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
return data_view.get(reserved_element_count=self.creaseLengths_size)
@creaseLengths.setter
def creaseLengths(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseLengths)
data_view.set(value)
self.creaseLengths_size = data_view.get_array_size()
@property
def creaseSharpnesses(self):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
return data_view.get(reserved_element_count=self.creaseSharpnesses_size)
@creaseSharpnesses.setter
def creaseSharpnesses(self, value):
data_view = og.AttributeValueHelper(self._attributes.creaseSharpnesses)
data_view.set(value)
self.creaseSharpnesses_size = data_view.get_array_size()
@property
def extent(self):
data_view = og.AttributeValueHelper(self._attributes.extent)
return data_view.get(reserved_element_count=self.extent_size)
@extent.setter
def extent(self, value):
data_view = og.AttributeValueHelper(self._attributes.extent)
data_view.set(value)
self.extent_size = data_view.get_array_size()
@property
def faceVertexCounts(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
return data_view.get(reserved_element_count=self.faceVertexCounts_size)
@faceVertexCounts.setter
def faceVertexCounts(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexCounts)
data_view.set(value)
self.faceVertexCounts_size = data_view.get_array_size()
@property
def faceVertexIndices(self):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
return data_view.get(reserved_element_count=self.faceVertexIndices_size)
@faceVertexIndices.setter
def faceVertexIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.faceVertexIndices)
data_view.set(value)
self.faceVertexIndices_size = data_view.get_array_size()
@property
def normalIndices(self):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
return data_view.get(reserved_element_count=self.normalIndices_size)
@normalIndices.setter
def normalIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.normalIndices)
data_view.set(value)
self.normalIndices_size = data_view.get_array_size()
@property
def normals(self):
data_view = og.AttributeValueHelper(self._attributes.normals)
return data_view.get(reserved_element_count=self.normals_size)
@normals.setter
def normals(self, value):
data_view = og.AttributeValueHelper(self._attributes.normals)
data_view.set(value)
self.normals_size = data_view.get_array_size()
@property
def points(self):
data_view = og.AttributeValueHelper(self._attributes.points)
return data_view.get(reserved_element_count=self.points_size)
@points.setter
def points(self, value):
data_view = og.AttributeValueHelper(self._attributes.points)
data_view.set(value)
self.points_size = data_view.get_array_size()
@property
def stIndices(self):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
return data_view.get(reserved_element_count=self.stIndices_size)
@stIndices.setter
def stIndices(self, value):
data_view = og.AttributeValueHelper(self._attributes.stIndices)
data_view.set(value)
self.stIndices_size = data_view.get_array_size()
@property
def sts(self):
data_view = og.AttributeValueHelper(self._attributes.sts)
return data_view.get(reserved_element_count=self.sts_size)
@sts.setter
def sts(self, value):
data_view = og.AttributeValueHelper(self._attributes.sts)
data_view.set(value)
self.sts_size = data_view.get_array_size()
@property
def parameterCheck(self):
value = self._batchedWriteValues.get(self._attributes.parameterCheck)
if value:
return value
else:
data_view = og.AttributeValueHelper(self._attributes.parameterCheck)
return data_view.get()
@parameterCheck.setter
def parameterCheck(self, value):
self._batchedWriteValues[self._attributes.parameterCheck] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnProceduralMeshCylinderDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnProceduralMeshCylinderDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnProceduralMeshCylinderDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 15,030 | Python | 45.535604 | 234 | 0.634132 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/tests/TestOgnProceduralMeshSphere.py | import omni.kit.test
import omni.graph.core as og
import omni.graph.core.tests as ogts
import os
class TestOgn(ogts.OmniGraphTestCase):
async def test_data_access(self):
from omni.kit.procedural.mesh.ogn.OgnProceduralMeshSphereDatabase import OgnProceduralMeshSphereDatabase
test_file_name = "OgnProceduralMeshSphereTemplate.usda"
usd_path = os.path.join(os.path.dirname(__file__), "usd", test_file_name)
if not os.path.exists(usd_path):
self.assertTrue(False, f"{usd_path} not found for loading test")
(result, error) = await ogts.load_test_file(usd_path)
self.assertTrue(result, f'{error} on {usd_path}')
test_node = og.Controller.node("/TestGraph/Template_omni_kit_procedural_mesh_CreateMeshSphere")
database = OgnProceduralMeshSphereDatabase(test_node)
self.assertTrue(test_node.is_valid())
node_type_name = test_node.get_type_name()
self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1)
def _attr_error(attribute: og.Attribute, usd_test: bool) -> str:
test_type = "USD Load" if usd_test else "Database Access"
return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error"
self.assertTrue(test_node.get_attribute_exists("inputs:diameter"))
attribute = test_node.get_attribute("inputs:diameter")
db_value = database.inputs.diameter
expected_value = 100
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:latitudeResolution"))
attribute = test_node.get_attribute("inputs:latitudeResolution")
db_value = database.inputs.latitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:longitudeResolution"))
attribute = test_node.get_attribute("inputs:longitudeResolution")
db_value = database.inputs.longitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:parameterCheck"))
attribute = test_node.get_attribute("inputs:parameterCheck")
db_value = database.inputs.parameterCheck
expected_value = -1
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("outputs:extent"))
attribute = test_node.get_attribute("outputs:extent")
db_value = database.outputs.extent
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexCounts"))
attribute = test_node.get_attribute("outputs:faceVertexCounts")
db_value = database.outputs.faceVertexCounts
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexIndices"))
attribute = test_node.get_attribute("outputs:faceVertexIndices")
db_value = database.outputs.faceVertexIndices
self.assertTrue(test_node.get_attribute_exists("outputs:parameterCheck"))
attribute = test_node.get_attribute("outputs:parameterCheck")
db_value = database.outputs.parameterCheck
self.assertTrue(test_node.get_attribute_exists("outputs:points"))
attribute = test_node.get_attribute("outputs:points")
db_value = database.outputs.points
self.assertTrue(test_node.get_attribute_exists("outputs:stIndices"))
attribute = test_node.get_attribute("outputs:stIndices")
db_value = database.outputs.stIndices
self.assertTrue(test_node.get_attribute_exists("outputs:sts"))
attribute = test_node.get_attribute("outputs:sts")
db_value = database.outputs.sts
| 4,426 | Python | 49.885057 | 112 | 0.696792 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/tests/TestOgnProceduralMeshCapsule.py | import omni.kit.test
import omni.graph.core as og
import omni.graph.core.tests as ogts
import os
class TestOgn(ogts.OmniGraphTestCase):
async def test_data_access(self):
from omni.kit.procedural.mesh.ogn.OgnProceduralMeshCapsuleDatabase import OgnProceduralMeshCapsuleDatabase
test_file_name = "OgnProceduralMeshCapsuleTemplate.usda"
usd_path = os.path.join(os.path.dirname(__file__), "usd", test_file_name)
if not os.path.exists(usd_path):
self.assertTrue(False, f"{usd_path} not found for loading test")
(result, error) = await ogts.load_test_file(usd_path)
self.assertTrue(result, f'{error} on {usd_path}')
test_node = og.Controller.node("/TestGraph/Template_omni_kit_procedural_mesh_CreateMeshCapsule")
database = OgnProceduralMeshCapsuleDatabase(test_node)
self.assertTrue(test_node.is_valid())
node_type_name = test_node.get_type_name()
self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1)
def _attr_error(attribute: og.Attribute, usd_test: bool) -> str:
test_type = "USD Load" if usd_test else "Database Access"
return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error"
self.assertTrue(test_node.get_attribute_exists("inputs:diameter"))
attribute = test_node.get_attribute("inputs:diameter")
db_value = database.inputs.diameter
expected_value = 100
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:hemisphereLatitudeResolution"))
attribute = test_node.get_attribute("inputs:hemisphereLatitudeResolution")
db_value = database.inputs.hemisphereLatitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:longitudeResolution"))
attribute = test_node.get_attribute("inputs:longitudeResolution")
db_value = database.inputs.longitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:middleLatitudeResolution"))
attribute = test_node.get_attribute("inputs:middleLatitudeResolution")
db_value = database.inputs.middleLatitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:parameterCheck"))
attribute = test_node.get_attribute("inputs:parameterCheck")
db_value = database.inputs.parameterCheck
expected_value = -1
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:yLength"))
attribute = test_node.get_attribute("inputs:yLength")
db_value = database.inputs.yLength
expected_value = 200
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("outputs:extent"))
attribute = test_node.get_attribute("outputs:extent")
db_value = database.outputs.extent
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexCounts"))
attribute = test_node.get_attribute("outputs:faceVertexCounts")
db_value = database.outputs.faceVertexCounts
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexIndices"))
attribute = test_node.get_attribute("outputs:faceVertexIndices")
db_value = database.outputs.faceVertexIndices
self.assertTrue(test_node.get_attribute_exists("outputs:parameterCheck"))
attribute = test_node.get_attribute("outputs:parameterCheck")
db_value = database.outputs.parameterCheck
self.assertTrue(test_node.get_attribute_exists("outputs:points"))
attribute = test_node.get_attribute("outputs:points")
db_value = database.outputs.points
self.assertTrue(test_node.get_attribute_exists("outputs:stIndices"))
attribute = test_node.get_attribute("outputs:stIndices")
db_value = database.outputs.stIndices
self.assertTrue(test_node.get_attribute_exists("outputs:sts"))
attribute = test_node.get_attribute("outputs:sts")
db_value = database.outputs.sts
| 5,375 | Python | 51.194174 | 114 | 0.699349 |
omniverse-code/kit/exts/omni.kit.procedural.mesh/omni/kit/procedural/mesh/ogn/tests/TestOgnProceduralMeshCone.py | import omni.kit.test
import omni.graph.core as og
import omni.graph.core.tests as ogts
import os
class TestOgn(ogts.OmniGraphTestCase):
async def test_data_access(self):
from omni.kit.procedural.mesh.ogn.OgnProceduralMeshConeDatabase import OgnProceduralMeshConeDatabase
test_file_name = "OgnProceduralMeshConeTemplate.usda"
usd_path = os.path.join(os.path.dirname(__file__), "usd", test_file_name)
if not os.path.exists(usd_path):
self.assertTrue(False, f"{usd_path} not found for loading test")
(result, error) = await ogts.load_test_file(usd_path)
self.assertTrue(result, f'{error} on {usd_path}')
test_node = og.Controller.node("/TestGraph/Template_omni_kit_procedural_mesh_CreateMeshCone")
database = OgnProceduralMeshConeDatabase(test_node)
self.assertTrue(test_node.is_valid())
node_type_name = test_node.get_type_name()
self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1)
def _attr_error(attribute: og.Attribute, usd_test: bool) -> str:
test_type = "USD Load" if usd_test else "Database Access"
return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error"
self.assertTrue(test_node.get_attribute_exists("inputs:capResolution"))
attribute = test_node.get_attribute("inputs:capResolution")
db_value = database.inputs.capResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:diameter"))
attribute = test_node.get_attribute("inputs:diameter")
db_value = database.inputs.diameter
expected_value = 100
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:height"))
attribute = test_node.get_attribute("inputs:height")
db_value = database.inputs.height
expected_value = 200
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:latitudeResolution"))
attribute = test_node.get_attribute("inputs:latitudeResolution")
db_value = database.inputs.latitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:longitudeResolution"))
attribute = test_node.get_attribute("inputs:longitudeResolution")
db_value = database.inputs.longitudeResolution
expected_value = 10
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:parameterCheck"))
attribute = test_node.get_attribute("inputs:parameterCheck")
db_value = database.inputs.parameterCheck
expected_value = -1
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("outputs:cornerIndices"))
attribute = test_node.get_attribute("outputs:cornerIndices")
db_value = database.outputs.cornerIndices
self.assertTrue(test_node.get_attribute_exists("outputs:cornerSharpnesses"))
attribute = test_node.get_attribute("outputs:cornerSharpnesses")
db_value = database.outputs.cornerSharpnesses
self.assertTrue(test_node.get_attribute_exists("outputs:creaseIndices"))
attribute = test_node.get_attribute("outputs:creaseIndices")
db_value = database.outputs.creaseIndices
self.assertTrue(test_node.get_attribute_exists("outputs:creaseLengths"))
attribute = test_node.get_attribute("outputs:creaseLengths")
db_value = database.outputs.creaseLengths
self.assertTrue(test_node.get_attribute_exists("outputs:creaseSharpnesses"))
attribute = test_node.get_attribute("outputs:creaseSharpnesses")
db_value = database.outputs.creaseSharpnesses
self.assertTrue(test_node.get_attribute_exists("outputs:extent"))
attribute = test_node.get_attribute("outputs:extent")
db_value = database.outputs.extent
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexCounts"))
attribute = test_node.get_attribute("outputs:faceVertexCounts")
db_value = database.outputs.faceVertexCounts
self.assertTrue(test_node.get_attribute_exists("outputs:faceVertexIndices"))
attribute = test_node.get_attribute("outputs:faceVertexIndices")
db_value = database.outputs.faceVertexIndices
self.assertTrue(test_node.get_attribute_exists("outputs:normalIndices"))
attribute = test_node.get_attribute("outputs:normalIndices")
db_value = database.outputs.normalIndices
self.assertTrue(test_node.get_attribute_exists("outputs:normals"))
attribute = test_node.get_attribute("outputs:normals")
db_value = database.outputs.normals
self.assertTrue(test_node.get_attribute_exists("outputs:parameterCheck"))
attribute = test_node.get_attribute("outputs:parameterCheck")
db_value = database.outputs.parameterCheck
self.assertTrue(test_node.get_attribute_exists("outputs:points"))
attribute = test_node.get_attribute("outputs:points")
db_value = database.outputs.points
self.assertTrue(test_node.get_attribute_exists("outputs:stIndices"))
attribute = test_node.get_attribute("outputs:stIndices")
db_value = database.outputs.stIndices
self.assertTrue(test_node.get_attribute_exists("outputs:sts"))
attribute = test_node.get_attribute("outputs:sts")
db_value = database.outputs.sts
| 6,707 | Python | 50.206106 | 108 | 0.699568 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.