-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autodesk: Text - Add the schema for SimpleText, together with the UnitTest #3258
Open
erikaharrison-adsk
wants to merge
1
commit into
PixarAnimationStudios:dev
Choose a base branch
from
autodesk-forks:adsk/feature/text/SimpleText-GPrim-schema
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ set(DIRS | |
usdHydra | ||
usdRi | ||
usdSkel | ||
usdText | ||
usdUI | ||
usdUtils | ||
usdPhysics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
set(PXR_PREFIX pxr/usd) | ||
set(PXR_PACKAGE usdText) | ||
|
||
pxr_library(usdText | ||
LIBRARIES | ||
tf | ||
usd | ||
usdGeom | ||
|
||
PUBLIC_CLASSES | ||
textStyleAPI | ||
textStyle | ||
simpleText | ||
tokens | ||
|
||
PUBLIC_HEADERS | ||
api.h | ||
|
||
PYTHON_CPPFILES | ||
moduleDeps.cpp | ||
|
||
PYMODULE_CPPFILES | ||
module.cpp | ||
wrapTextStyleAPI.cpp | ||
wrapTextStyle.cpp | ||
wrapSimpleText.cpp | ||
wrapTokens.cpp | ||
${optionalPyModuleFiles} | ||
|
||
PYMODULE_FILES | ||
__init__.py | ||
|
||
RESOURCE_FILES | ||
plugInfo.json | ||
generatedSchema.usda | ||
schema.usda:usdText/schema.usda | ||
) | ||
|
||
pxr_test_scripts( | ||
testenv/testUsdTextSimpleText.py | ||
testenv/testUsdTextSchemata.py | ||
) | ||
|
||
pxr_install_test_dir( | ||
SRC testenv/testUsdTextSimpleText | ||
DEST testUsdTextSimpleText | ||
) | ||
|
||
pxr_register_test(testUsdTextSchemata | ||
PYTHON | ||
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdTextSchemata" | ||
EXPECTED_RETURN_CODE 0 | ||
) | ||
|
||
pxr_register_test(testUsdTextSimpleText | ||
PYTHON | ||
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdTextSimpleText" | ||
EXPECTED_RETURN_CODE 0 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# Copyright 2024 Pixar | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "Apache License") | ||
# with the following modification; you may not use this file except in | ||
# compliance with the Apache License and the following modification to it: | ||
# Section 6. Trademarks. is deleted and replaced with: | ||
# | ||
# 6. Trademarks. This License does not grant permission to use the trade | ||
# names, trademarks, service marks, or product names of the Licensor | ||
# and its affiliates, except as required to comply with Section 4(c) of | ||
# the License and to reproduce the content of the NOTICE file. | ||
# | ||
# You may obtain a copy of the Apache License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the Apache License with the above modification is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the Apache License for the specific | ||
# language governing permissions and limitations under the Apache License. | ||
# | ||
from pxr import Tf | ||
Tf.PreparePythonModule() | ||
del Tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright 2024 Pixar | ||
// | ||
// Licensed under the terms set forth in the LICENSE.txt file available at | ||
// https://openusd.org/license. | ||
// | ||
#ifndef USDTEXT_API_H | ||
#define USDTEXT_API_H | ||
|
||
#include "pxr/base/arch/export.h" | ||
|
||
#if defined(PXR_STATIC) | ||
# define USDTEXT_API | ||
# define USDTEXT_API_TEMPLATE_CLASS(...) | ||
# define USDTEXT_API_TEMPLATE_STRUCT(...) | ||
# define USDTEXT_LOCAL | ||
#else | ||
# if defined(USDTEXT_EXPORTS) | ||
# define USDTEXT_API ARCH_EXPORT | ||
# define USDTEXT_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) | ||
# define USDTEXT_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) | ||
# else | ||
# define USDTEXT_API ARCH_IMPORT | ||
# define USDTEXT_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) | ||
# define USDTEXT_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) | ||
# endif | ||
# define USDTEXT_LOCAL ARCH_HIDDEN | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
#usda 1.0 | ||
( | ||
"WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." | ||
) | ||
|
||
class TextStyle "TextStyle" ( | ||
doc = "This class includes the properties of the font and character." | ||
) | ||
{ | ||
uniform int charHeight ( | ||
doc = "The height of the character." | ||
) | ||
uniform float charSpacingFactor = 1 ( | ||
doc = "The factor how the character space is enlarged." | ||
) | ||
uniform float charWidthFactor = 1 ( | ||
doc = """The factor how a character's width is enlarged. If the width of a normal character is 1.0, and this | ||
factor is 0.5, the final width of the character will be 0.5.""" | ||
) | ||
uniform string font:altFormat = "none" ( | ||
allowedTokens = ["none", "ttf/cff/otf", "fon", "pcf", "shx", "pfa/pfb", "bdf"] | ||
doc = '''The font format for the alternate typeface. When this value is "none", it means the font format | ||
is the default format. User can define the default format. For example, on Windows you can define the default | ||
format is "ttf/cff/otf".''' | ||
) | ||
uniform string font:altTypeface ( | ||
doc = "An alternate typeface. It will be used if the 'typeface' is not available in the system." | ||
) | ||
uniform bool font:bold = 0 ( | ||
doc = "Whether the font style contains bold style. It is valid only when font:weight is zero or negative." | ||
) | ||
uniform string font:format = "none" ( | ||
allowedTokens = ["none", "ttf/cff/otf", "fon", "pcf", "shx", "pfa/pfb", "bdf"] | ||
doc = '''The font format. When this value is "none", it means the font format is the default format. User | ||
can define the default format. For example, on Windows you can define the default format is "ttf/cff/otf".''' | ||
) | ||
uniform bool font:italic = 0 ( | ||
doc = "Whether the font style contains italic style." | ||
) | ||
uniform string font:typeface ( | ||
doc = "The typeface of the font." | ||
) | ||
uniform int font:weight = 0 ( | ||
doc = """The weight of the stroke. If it is zero or negative, it means this property is ignored. Otherwise, | ||
the definition of the weight value is the same as the definition of weight in CSS. | ||
|
||
This is how the weight is mapped to a font style in CSS. | ||
weight value | font style | ||
-------------- | ----------- | ||
100 | Thin | ||
200 | Extra Light | ||
300 | Light | ||
400 | Normal(Regular) | ||
500 | Medium | ||
600 | Semi Bold | ||
700 | Bold | ||
800 | Extra Bold | ||
900 | Ultra Bold | ||
|
||
If the value is not in the table, we will find a nearest value in the table, and the style will be the | ||
corresponding font style. | ||
""" | ||
) | ||
uniform float obliqueAngle = 0 ( | ||
doc = """The slant angle of the character. It is often achieved by applying a skew matrix to the original | ||
character.""" | ||
) | ||
uniform string overlineType = "none" ( | ||
allowedTokens = ["none", "normal"] | ||
doc = "The type of overline." | ||
) | ||
uniform string strikethroughType = "none" ( | ||
allowedTokens = ["none", "normal", "doubleLines"] | ||
doc = "The type of strikethrough." | ||
) | ||
uniform string underlineType = "none" ( | ||
allowedTokens = ["none", "normal"] | ||
doc = "The type of underline." | ||
) | ||
} | ||
|
||
class "TextStyleAPI" ( | ||
doc = """UsdTextTextStyleAPI is an API schema that provides an interface for binding text style to a text | ||
primitive.""" | ||
) | ||
{ | ||
} | ||
|
||
class "TextLayoutAPI" ( | ||
doc = """UsdTextTextLayoutAPI is an API schema that provides an interface for setting the layout of a text | ||
primitive.""" | ||
) | ||
{ | ||
uniform token layout:baselineDirection = "upToImpl" ( | ||
allowedTokens = ["upToImpl", "leftToRight", "rightToLeft", "topToBottom", "bottomToTop"] | ||
doc = "The direction of the baseline." | ||
) | ||
uniform token layout:linesStackDirection = "upToImpl" ( | ||
allowedTokens = ["upToImpl", "leftToRight", "rightToLeft", "topToBottom", "bottomToTop"] | ||
doc = """The direction of the line stacking. | ||
If layout:baselineDirection is 'leftToRight' or 'rightToLeft', the layout:linesStackDirection can not be | ||
'leftToRight' or 'rightToLeft'. If layout:baselineDirection is 'topToBottom' or 'bottomToTop', the | ||
layout:linesStackDirection can not be 'topToBottom' or 'bottomToTop'.""" | ||
) | ||
} | ||
|
||
class SimpleText "SimpleText" ( | ||
doc = """Class for single line single style text. | ||
'Single line' means that the baseline of the characters is straight and there is no line break. | ||
'Single style' means the appearance style for the characters are assumed to be the same. Here, | ||
we use 'assume' because the user would like that the style is the same, but in the implementation, | ||
a part of the characters may not be supported so it may use an alternate style to display the | ||
characters. That is, although in schema level we use one text style for the SimpleText, on the | ||
screen some characters may still be rendered with a different style.""" | ||
) | ||
{ | ||
uniform bool doubleSided = 0 ( | ||
doc = """Although some renderers treat all parametric or polygonal | ||
surfaces as if they were effectively laminae with outward-facing | ||
normals on both sides, some renderers derive significant optimizations | ||
by considering these surfaces to have only a single outward side, | ||
typically determined by control-point winding order and/or | ||
orientation. By doing so they can perform \"backface culling\" to | ||
avoid drawing the many polygons of most closed surfaces that face away | ||
from the viewer. | ||
|
||
However, it is often advantageous to model thin objects such as paper | ||
and cloth as single, open surfaces that must be viewable from both | ||
sides, always. Setting a gprim's doubleSided attribute to | ||
\\c true instructs all renderers to disable optimizations such as | ||
backface culling for the gprim, and attempt (not all renderers are able | ||
to do so, but the USD reference GL renderer always will) to provide | ||
forward-facing normals on each side of the surface for lighting | ||
calculations.""" | ||
) | ||
float3[] extent ( | ||
doc = """Extent is a three dimensional range measuring the geometric | ||
extent of the authored gprim in its own local space (i.e. its own | ||
transform not applied), without accounting for any shader-induced | ||
displacement. If __any__ extent value has been authored for a given | ||
Boundable, then it should be authored at every timeSample at which | ||
geometry-affecting properties are authored, to ensure correct | ||
evaluation via ComputeExtent(). If __no__ extent value has been | ||
authored, then ComputeExtent() will call the Boundable's registered | ||
ComputeExtentFunction(), which may be expensive, which is why we | ||
strongly encourage proper authoring of extent. | ||
\\sa ComputeExtent() | ||
\\sa \\ref UsdGeom_Boundable_Extent. | ||
|
||
An authored extent on a prim which has children is expected to include | ||
the extent of all children, as they will be pruned from BBox computation | ||
during traversal.""" | ||
) | ||
uniform token orientation = "rightHanded" ( | ||
allowedTokens = ["rightHanded", "leftHanded"] | ||
doc = """Orientation specifies whether the gprim's surface normal | ||
should be computed using the right hand rule, or the left hand rule. | ||
Please see for a deeper explanation and | ||
generalization of orientation to composed scenes with transformation | ||
hierarchies.""" | ||
) | ||
uniform color3f primvars:backgroundColor ( | ||
doc = "Background color for the text." | ||
) | ||
uniform float primvars:backgroundOpacity = 0 ( | ||
doc = "Background opacity for the text." | ||
) | ||
color3f[] primvars:displayColor ( | ||
doc = '''It is useful to have an "official" colorSet that can be used | ||
as a display or modeling color, even in the absence of any specified | ||
shader for a gprim. DisplayColor serves this role; because it is a | ||
UsdGeomPrimvar, it can also be used as a gprim override for any shader | ||
that consumes a displayColor parameter.''' | ||
) | ||
float[] primvars:displayOpacity ( | ||
doc = """Companion to displayColor that specifies opacity, broken | ||
out as an independent attribute rather than an rgba color, both so that | ||
each can be independently overridden, and because shaders rarely consume | ||
rgba parameters.""" | ||
) | ||
rel proxyPrim ( | ||
doc = '''The proxyPrim relationship allows us to link a | ||
prim whose purpose is "render" to its (single target) | ||
purpose="proxy" prim. This is entirely optional, but can be | ||
useful in several scenarios: | ||
|
||
- In a pipeline that does pruning (for complexity management) | ||
by deactivating prims composed from asset references, when we | ||
deactivate a purpose="render" prim, we will be able to discover | ||
and additionally deactivate its associated purpose="proxy" prim, | ||
so that preview renders reflect the pruning accurately. | ||
|
||
- DCC importers may be able to make more aggressive optimizations | ||
for interactive processing and display if they can discover the proxy | ||
for a given render prim. | ||
|
||
- With a little more work, a Hydra-based application will be able | ||
to map a picked proxy prim back to its render geometry for selection. | ||
|
||
\\note It is only valid to author the proxyPrim relationship on | ||
prims whose purpose is "render".''' | ||
) | ||
uniform token purpose = "default" ( | ||
allowedTokens = ["default", "render", "proxy", "guide"] | ||
doc = """Purpose is a classification of geometry into categories that | ||
can each be independently included or excluded from traversals of prims | ||
on a stage, such as rendering or bounding-box computation traversals. | ||
|
||
See for more detail about how | ||
purpose is computed and used.""" | ||
) | ||
uniform string textData ( | ||
doc = "The text string data." | ||
) | ||
uniform token textMetricsUnit = "worldUnit" ( | ||
allowedTokens = ["worldUnit", "publishingPoint", "pixel"] | ||
doc = """The unit for the text related metrics, such as the unit of charHeight. | ||
If the value is 'pixel', the unit of text metrics will be the same as a pixel in the framebuffer. | ||
If the value is 'publishingPoint', the unit will be the same as desktop publishing point, or 1/72 | ||
of an inch on a screen's physical display. If textMetricsUnit is 'worldUnit'\", the unit will be | ||
the same as the unit of the world space. | ||
If the text primitive has billboard, the textMetricsUnit can only be 'pixel' or 'publishingPoint'. | ||
Otherwise, the textMetricsUnit can only be 'worldUnit'. | ||
""" | ||
) | ||
token visibility = "inherited" ( | ||
allowedTokens = ["inherited", "invisible"] | ||
doc = '''Visibility is meant to be the simplest form of "pruning" | ||
visibility that is supported by most DCC apps. Visibility is | ||
animatable, allowing a sub-tree of geometry to be present for some | ||
segment of a shot, and absent from others; unlike the action of | ||
deactivating geometry prims, invisible geometry is still | ||
available for inspection, for positioning, for defining volumes, etc.''' | ||
) | ||
uniform token[] xformOpOrder ( | ||
doc = """Encodes the sequence of transformation operations in the | ||
order in which they should be pushed onto a transform stack while | ||
visiting a UsdStage's prims in a graph traversal that will effect | ||
the desired positioning for this prim and its descendant prims. | ||
|
||
You should rarely, if ever, need to manipulate this attribute directly. | ||
It is managed by the AddXformOp(), SetResetXformStack(), and | ||
SetXformOpOrder(), and consulted by GetOrderedXformOps() and | ||
GetLocalTransformation().""" | ||
) | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script generated file. Do not review.