file_path
stringlengths 20
207
| content
stringlengths 5
3.85M
| size
int64 5
3.85M
| lang
stringclasses 9
values | avg_line_length
float64 1.33
100
| max_line_length
int64 4
993
| alphanum_fraction
float64 0.26
0.93
|
---|---|---|---|---|---|---|
mati-nvidia/omni-bookshelf-generator/tools/packman/config.packman.xml | <config remotes="cloudfront">
<remote2 name="cloudfront">
<transport actions="download" protocol="https" packageLocation="d4i3qtqj3r0z5.cloudfront.net/${name}@${version}" />
</remote2>
</config>
| 211 | XML | 34.333328 | 123 | 0.691943 |
mati-nvidia/omni-bookshelf-generator/tools/packman/bootstrap/install_package.py | # Copyright 2019 NVIDIA CORPORATION
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import zipfile
import tempfile
import sys
import shutil
__author__ = "hfannar"
logging.basicConfig(level=logging.WARNING, format="%(message)s")
logger = logging.getLogger("install_package")
class TemporaryDirectory:
def __init__(self):
self.path = None
def __enter__(self):
self.path = tempfile.mkdtemp()
return self.path
def __exit__(self, type, value, traceback):
# Remove temporary data created
shutil.rmtree(self.path)
def install_package(package_src_path, package_dst_path):
with zipfile.ZipFile(
package_src_path, allowZip64=True
) as zip_file, TemporaryDirectory() as temp_dir:
zip_file.extractall(temp_dir)
# Recursively copy (temp_dir will be automatically cleaned up on exit)
try:
# Recursive copy is needed because both package name and version folder could be missing in
# target directory:
shutil.copytree(temp_dir, package_dst_path)
except OSError as exc:
logger.warning(
"Directory %s already present, packaged installation aborted" % package_dst_path
)
else:
logger.info("Package successfully installed to %s" % package_dst_path)
install_package(sys.argv[1], sys.argv[2])
| 1,888 | Python | 31.568965 | 103 | 0.68697 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/maticodes/generator/bookshelf/extension.py | # SPDX-License-Identifier: Apache-2.0
import omni.ext
from .ui import BookshelfGenWindow
# Any class derived from `omni.ext.IExt` in top level module (defined in `python.modules` of `extension.toml`) will be
# instantiated when extension gets enabled and `on_startup(ext_id)` will be called. Later when extension gets disabled
# on_shutdown() is called.
class BookshelfGeneratorExtension(omni.ext.IExt):
# ext_id is current extension id. It can be used with extension manager to query additional information, like where
# this extension is located on filesystem.
def on_startup(self, ext_id):
print("[maticodes.generator.bookshelf] BookshelfGeneratorExtension startup")
self._window = BookshelfGenWindow("Bookshelf Generator", width=300, height=300)
def on_shutdown(self):
print("[maticodes.generator.bookshelf] BookshelfGeneratorExtension shutdown")
self._window.destroy()
self._window = None
| 974 | Python | 37.999998 | 119 | 0.727926 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/maticodes/generator/bookshelf/__init__.py | # SPDX-License-Identifier: Apache-2.0
from .extension import *
| 64 | Python | 15.249996 | 37 | 0.75 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/maticodes/generator/bookshelf/utils.py |
from signal import SIG_DFL
# SPDX-License-Identifier: Apache-2.0
from pxr import UsdGeom
def stage_up_adjust(stage, values, vec_type):
if UsdGeom.GetStageUpAxis(stage) == UsdGeom.Tokens.z:
return vec_type(values[0], values[2], values[1])
else:
return vec_type(*values) | 296 | Python | 23.749998 | 57 | 0.689189 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/maticodes/generator/bookshelf/generator.py | # SPDX-License-Identifier: Apache-2.0
import random
import typing
import weakref
from pathlib import Path
import carb
import omni.kit.app
import omni.kit.commands
import omni.usd
from omni.kit.property.usd.prim_selection_payload import PrimSelectionPayload
from pxr import Gf, Sdf, Usd, UsdGeom
from .utils import stage_up_adjust
BOOK_A_USD = Path(__file__).parent.parent.parent.parent / "data" / "book_A.usd"
CUBE_POINTS_TEMPLATE = [(-1, -1, -1), (1, -1, -1), (-1, -1, 1), (1, -1, 1), (-1, 1, -1), (1, 1, -1), (1, 1, 1), (-1, 1, 1)]
class BookshelfGenerator:
def __init__(self, asset_root_path: typing.Union[str, Sdf.Path]=None) -> None:
self._stage:Usd.Stage = omni.usd.get_context().get_stage()
if asset_root_path is None:
self.create_new()
else:
if isinstance(asset_root_path, str):
self._asset_root_path = Sdf.Path(asset_root_path)
else:
self._asset_root_path = asset_root_path
self.from_usd()
self._stage_subscription = omni.usd.get_context().get_stage_event_stream().create_subscription_to_pop(
self._on_usd_context_event, name="Bookshelf Generator USD Stage Open Listening"
)
def _on_usd_context_event(self, event: carb.events.IEvent):
if event.type == int(omni.usd.StageEventType.OPENED):
self._stage = omni.usd.get_context().get_stage()
def from_usd(self):
prim = self._stage.GetPrimAtPath(self._asset_root_path)
self.width = prim.GetAttribute("bookshelf_gen:width").Get()
self.height = prim.GetAttribute("bookshelf_gen:height").Get()
self.depth = prim.GetAttribute("bookshelf_gen:depth").Get()
self.thickness = prim.GetAttribute("bookshelf_gen:thickness").Get()
self.num_shelves = prim.GetAttribute("bookshelf_gen:numShelves").Get()
self.geom_scope_path = self._asset_root_path.AppendPath("Geometry")
self.looks_scope_path = self._asset_root_path.AppendPath("Looks")
instancer_path = self.geom_scope_path.AppendPath("BooksInstancer")
self.instancer = UsdGeom.PointInstancer(self._stage.GetPrimAtPath(instancer_path))
look_prim = self._stage.GetPrimAtPath(self.looks_scope_path)
self.shelf_mtl_path = look_prim.GetChildren()[0].GetPath()
def create_shelf_material(self, looks_scope_path):
self.shelf_mtl_path = Sdf.Path(omni.usd.get_stage_next_free_path(self._stage, looks_scope_path.AppendPath("Cherry"), False))
result = omni.kit.commands.execute('CreateMdlMaterialPrimCommand',
mtl_url='http://omniverse-content-production.s3-us-west-2.amazonaws.com/Materials/Base/Wood/Cherry.mdl',
mtl_name='Cherry',
mtl_path=str(self.shelf_mtl_path))
omni.kit.commands.execute('SelectPrims',
old_selected_paths=[],
new_selected_paths=[str(self.shelf_mtl_path)],
expand_in_stage=True)
@property
def books_instancer_path(self):
return self.instancer.GetPath()
@property
def asset_root_path(self):
return self._asset_root_path
def create_new(self):
self._asset_root_path = Sdf.Path(omni.usd.get_stage_next_free_path(self._stage, "/World/Bookshelf", False))
self.geom_scope_path = Sdf.Path(omni.usd.get_stage_next_free_path(self._stage, self._asset_root_path.AppendPath("Geometry"), False))
self.looks_scope_path = Sdf.Path(omni.usd.get_stage_next_free_path(self._stage, self._asset_root_path.AppendPath("Looks"), False))
omni.kit.commands.execute('CreatePrim', prim_type='Xform', prim_path=str(self._asset_root_path))
omni.kit.commands.execute('CreatePrim', prim_type='Scope', prim_path=str(self.geom_scope_path))
omni.kit.commands.execute('CreatePrim', prim_type='Scope', prim_path=str(self.looks_scope_path))
self.create_shelf_material(self.looks_scope_path)
prototypes_container_path = self.geom_scope_path.AppendPath("Prototypes")
self.width = 150
self.height = 200
self.depth = 25
self.thickness = 2
self.num_shelves = 3
self.randomize_scale = True
self.set_bookshelf_attrs()
instancer_path = Sdf.Path(omni.usd.get_stage_next_free_path(
self._stage,
self.geom_scope_path.AppendPath("BooksInstancer"),
False)
)
self.instancer = UsdGeom.PointInstancer.Define(self._stage, instancer_path)
omni.kit.commands.execute('AddXformOp',
payload=PrimSelectionPayload(weakref.ref(self._stage), [instancer_path]),
precision=UsdGeom.XformOp.PrecisionDouble,
rotation_order='XYZ',
add_translate_op=True,
add_rotateXYZ_op=True,
add_orient_op=False,
add_scale_op=True,
add_transform_op=False,
add_pivot_op=False)
self.instancer.CreatePositionsAttr().Set([])
self.instancer.CreateScalesAttr().Set([])
self.instancer.CreateProtoIndicesAttr().Set([])
def set_bookshelf_attrs(self):
asset_root_prim:Usd.Prim = self._stage.GetPrimAtPath(self._asset_root_path)
asset_root_prim.CreateAttribute("bookshelf_gen:width", Sdf.ValueTypeNames.Float, custom=True).Set(self.width)
asset_root_prim.CreateAttribute("bookshelf_gen:height", Sdf.ValueTypeNames.Float, custom=True).Set(self.height)
asset_root_prim.CreateAttribute("bookshelf_gen:depth", Sdf.ValueTypeNames.Float, custom=True).Set(self.depth)
asset_root_prim.CreateAttribute("bookshelf_gen:thickness", Sdf.ValueTypeNames.Float, custom=True).Set(self.thickness)
asset_root_prim.CreateAttribute("bookshelf_gen:numShelves", Sdf.ValueTypeNames.Float, custom=True).Set(self.num_shelves)
def create_default_prototypes(self):
asset_root_prim:Usd.Prim = self._stage.GetPrimAtPath(self._asset_root_path)
geom_scope_path = self._asset_root_path.AppendPath("Geometry")
prototypes:Usd.Prim = self._stage.OverridePrim(geom_scope_path.AppendPath("Prototypes"))
book_stage:Usd.Stage = Usd.Stage.Open(str(BOOK_A_USD))
default_prim = book_stage.GetDefaultPrim()
variants = default_prim.GetVariantSet("color").GetVariantNames()
paths = []
for variant in variants:
book_path = omni.usd.get_stage_next_free_path(self._stage,
prototypes.GetPath().AppendPath("book_A"),
False
)
omni.kit.commands.execute('CreateReference',
path_to=book_path,
asset_path=str(BOOK_A_USD),
usd_context=omni.usd.get_context()
)
prim = self._stage.GetPrimAtPath(book_path)
prim.GetVariantSet("color").SetVariantSelection(variant)
asset_xform = UsdGeom.Xform(prim)
if UsdGeom.GetStageUpAxis(self._stage) == UsdGeom.Tokens.z:
rotate_attr = prim.GetAttribute("xformOp:rotateXYZ")
rotation = rotate_attr.Get()
rotation[2] = 0
rotate_attr.Set(rotation)
asset_xform.SetResetXformStack(True)
paths.append(book_path)
prototypes.SetSpecifier(Sdf.SpecifierOver)
self.instancer.CreatePrototypesRel().SetTargets(paths)
def get_prototype_attrs(self):
self.prototype_widths = []
self.prototype_paths = []
bbox_cache = UsdGeom.BBoxCache(Usd.TimeCode.Default(), includedPurposes=[UsdGeom.Tokens.default_])
self.prototype_paths = self.instancer.GetPrototypesRel().GetForwardedTargets()
if len(self.prototype_paths) < 1:
raise ValueError("You must provide at least one prototype.")
proto_container = self.prototype_paths[0].GetParentPath()
container_prim = self._stage.GetPrimAtPath(proto_container)
container_prim.SetSpecifier(Sdf.SpecifierDef)
for prototype_path in self.prototype_paths:
proto_prim = self._stage.GetPrimAtPath(prototype_path)
bbox = bbox_cache.ComputeWorldBound(proto_prim)
bbox_range = bbox.GetRange()
bbox_min = bbox_range.GetMin()
bbox_max = bbox_range.GetMax()
self.prototype_widths.append(bbox_max[0] - bbox_min[0])
container_prim.SetSpecifier(Sdf.SpecifierOver)
def generate(self, width=100, height=250, depth=20, thickness=2, num_shelves=3, randomize_scale=True):
self.width = width
self.height = height
self.depth = depth
self.thickness = thickness
self.num_shelves = num_shelves
self.randomize_scale = randomize_scale
self.set_bookshelf_attrs()
self.positions = []
self.scales = []
self.proto_ids = []
self.get_prototype_attrs()
self.clear_boards()
self.create_frame()
self.create_shelves(self.num_shelves)
omni.usd.get_context().get_selection().clear_selected_prim_paths()
def clear_boards(self):
geom_scope_prim: Usd.Prim = self._stage.GetPrimAtPath(self.geom_scope_path)
boards = []
for child in geom_scope_prim.GetAllChildren():
if child.GetName().startswith("Board"):
boards.append(child.GetPath())
omni.kit.commands.execute('DeletePrims',
paths=boards,
destructive=False
)
def create_books(self, shelf_height):
x = 0
def get_random_id():
return random.randint(0, len(self.prototype_paths)-1)
id = get_random_id()
while True:
if self.randomize_scale:
width_scalar = random.random() * 1 + 1
height_scalar = random.random() * 0.5 + 1
else:
width_scalar = 1
height_scalar = 1
if x + self.prototype_widths[id] * width_scalar > self.width:
break
pos = stage_up_adjust(self._stage,
[x + self.prototype_widths[id] * width_scalar / 2, shelf_height, 0],
Gf.Vec3f
)
self.positions.append(pos)
scale = stage_up_adjust(self._stage,
[width_scalar, height_scalar, 1],
Gf.Vec3d
)
self.scales.append(scale)
self.proto_ids.append(id)
# Update for next loop for next loop
x += self.prototype_widths[id] * width_scalar
id = get_random_id()
self.instancer.GetPositionsAttr().Set(self.positions)
self.instancer.GetScalesAttr().Set(self.scales)
self.instancer.GetProtoIndicesAttr().Set(self.proto_ids)
def create_shelves(self, num_shelves):
translate_attr = self.instancer.GetPrim().GetAttribute("xformOp:translate")
translate_attr.Set(stage_up_adjust(self._stage, [-self.width/2, self.thickness/2, 0], Gf.Vec3d))
# Put books on the bottom of the frame
self.create_books(self.thickness/2)
# Generate the other shelves
if num_shelves > 0:
offset = self.height / (num_shelves + 1)
for num in range(1, num_shelves + 1):
board = self.create_board(self.width)
shelf_y_pos = num * offset + self.thickness/2
translate = stage_up_adjust(self._stage, [0, shelf_y_pos, 0], Gf.Vec3d)
board.GetAttribute("xformOp:translate").Set(translate)
self.create_books(shelf_y_pos)
def create_frame(self):
# bottom
board = self.create_board(self.width)
translate = stage_up_adjust(self._stage, [0, self.thickness/2, 0], Gf.Vec3d)
board.GetAttribute("xformOp:translate").Set(translate)
# top
board = self.create_board(self.width)
translate = stage_up_adjust(self._stage, [0, self.height - self.thickness/2, 0], Gf.Vec3d)
board.GetAttribute("xformOp:translate").Set(translate)
# left
board = self.create_board(self.height)
translate = stage_up_adjust(self._stage, [-self.width/2 - self.thickness/2, self.height/2, 0], Gf.Vec3d)
board.GetAttribute("xformOp:translate").Set(translate)
rotate = stage_up_adjust(self._stage, [0, 0, 90], Gf.Vec3d)
board.GetAttribute("xformOp:rotateXYZ").Set(rotate)
# right
board = self.create_board(self.height)
translate = stage_up_adjust(self._stage, [self.width/2 + self.thickness/2, self.height/2, 0], Gf.Vec3d)
board.GetAttribute("xformOp:translate").Set(translate)
rotate = stage_up_adjust(self._stage, [0, 0, 90], Gf.Vec3d)
board.GetAttribute("xformOp:rotateXYZ").Set(rotate)
def create_board(self, width):
cube_prim_path = omni.usd.get_stage_next_free_path(self._stage, self.geom_scope_path.AppendPath("Board"), False)
success, result = omni.kit.commands.execute('CreateMeshPrimWithDefaultXform', prim_type='Cube')
omni.kit.commands.execute('MovePrim',
path_from=result,
path_to=cube_prim_path)
result = omni.kit.commands.execute('BindMaterialCommand',
prim_path=cube_prim_path,
material_path=str(self.shelf_mtl_path),
strength='strongerThanDescendants')
tx_scale_y = self.depth / width
# shader_prim = self._stage.GetPrimAtPath(mtl_path.AppendPath("Shader"))
# tx_scale_attr = shader_prim.CreateAttribute("inputs:texture_scale", Sdf.ValueTypeNames.Float2)
# tx_scale_attr.Set((1.0, tx_scale_y))
cube_prim = self._stage.GetPrimAtPath(cube_prim_path)
uv_attr = cube_prim.GetAttribute("primvars:st")
uvs = uv_attr.Get()
for x in range(len(uvs)):
uvs[x] = (uvs[x][0], uvs[x][1] * tx_scale_y)
uv_attr.Set(uvs)
points_attr = cube_prim.GetAttribute("points")
scaled_points = []
for point in CUBE_POINTS_TEMPLATE:
x = width / 2 * point[0]
y = self.thickness / 2 * point[1]
z = self.depth / 2 * point[2]
scale = stage_up_adjust(self._stage, [x, y, z], Gf.Vec3d)
scaled_points.append(scale)
points_attr.Set(scaled_points)
return cube_prim
| 14,328 | Python | 43.638629 | 140 | 0.619417 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/maticodes/generator/bookshelf/ui.py | # SPDX-License-Identifier: Apache-2.0
import carb
import omni.ui as ui
import omni.usd
from omni.kit.property.usd.relationship import RelationshipEditWidget
from .generator import BookshelfGenerator
class PrototypesRelEditWidget(RelationshipEditWidget):
def __init__(self, stage, attr_name, prim_paths):
kwargs = {
"on_remove_target": self.on_change_cb,
"target_picker_on_add_targets": self.on_change_cb
}
super().__init__(stage, attr_name, prim_paths, additional_widget_kwargs=kwargs)
def on_change_cb(self, *args):
self._set_dirty()
class BookshelfGenWindow(ui.Window):
def __init__(self, title: str, **kwargs) -> None:
super().__init__(title, **kwargs)
self._stage = omni.usd.get_context().get_stage()
self.bookshelves = []
self.current_index = -1
self.current_bookshelf = None
self.frame.set_build_fn(self.build_frame)
self._combo_changed_sub = None
self._stage_subscription = omni.usd.get_context().get_stage_event_stream().create_subscription_to_pop(
self._on_usd_context_event, name="Bookshelf Generator UI USD Stage Open Listening"
)
self.randomize_book_model = ui.SimpleBoolModel(True)
def _on_usd_context_event(self, event: carb.events.IEvent):
if event.type == int(omni.usd.StageEventType.OPENED):
self._stage = omni.usd.get_context().get_stage()
def get_bookshelves(self):
self.bookshelves = []
bookshelf_paths = []
for prim in self._stage.Traverse():
if prim.HasAttribute("bookshelf_gen:width"):
self.bookshelves.append(BookshelfGenerator(prim.GetPath()))
bookshelf_paths.append(prim.GetPath())
if (self.current_bookshelf is not None and self.current_index < len(self.bookshelves)
and self.current_bookshelf.asset_root_path == self.bookshelves[self.current_index].asset_root_path):
return
self.current_index = -1
self.current_bookshelf = None
for i, bookshelf_path in enumerate(bookshelf_paths):
if (self.current_bookshelf is not None
and bookshelf_path == self.current_bookshelf.asset_root_path):
self.current_index = i
self.current_bookshelf: BookshelfGenerator = self.bookshelves[self.current_index]
def build_frame(self):
self.get_bookshelves()
with ui.VStack():
with ui.HStack(height=0):
combo_model = ui.ComboBox(self.current_index,*[str(x.asset_root_path) for x in self.bookshelves]).model
def combo_changed(item_model, item):
value_model = item_model.get_item_value_model(item)
self.current_bookshelf = self.bookshelves[value_model.as_int]
self.current_index = value_model.as_int
self.reload_frame()
self._combo_changed_sub = combo_model.subscribe_item_changed_fn(combo_changed)
def create_new():
self.current_bookshelf: BookshelfGenerator = BookshelfGenerator()
self.bookshelves.append(self.current_bookshelf)
self.current_index = len(self.bookshelves) - 1
value_model = combo_model.get_item_value_model()
value_model.set_value(self.current_index)
ui.Button("Create New", width=0, clicked_fn=lambda: create_new())
def reload_frame():
self.reload_frame()
ui.Button("Reload", width=0, clicked_fn=lambda: reload_frame())
if self.current_index == -1:
if len(self.bookshelves) > 0:
ui.Label("Create a new bookshelf or select an existing one from the dropdown to get started.",
word_wrap=True,
alignment=ui.Alignment.CENTER
)
else:
ui.Label("Create a new bookshelf or to get started.",
word_wrap=True,
alignment=ui.Alignment.CENTER
)
else:
def create_default_prototypes():
self.current_bookshelf.create_default_prototypes()
self.proto_edit_widget.on_change_cb()
with ui.VStack(height=0):
with ui.CollapsableFrame("Prototypes", collapsed=True):
with ui.VStack():
ui.Button("Create Default Prototypes", height=0, clicked_fn=lambda: create_default_prototypes())
with ui.ScrollingFrame(height=200):
with ui.VStack():
self.proto_edit_widget = PrototypesRelEditWidget(
self._stage,
"prototypes",
[self.current_bookshelf.books_instancer_path]
)
ui.Spacer()
ui.Spacer()
ui.Spacer()
ui.Spacer()
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Width (cm): ")
self.width_model = ui.SimpleIntModel(int(self.current_bookshelf.width))
ui.IntField(model=self.width_model, width=50)
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Height (cm): ")
self.height_model = ui.SimpleIntModel(int(self.current_bookshelf.height))
ui.IntField(model=self.height_model, width=50)
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Depth (cm): ")
self.depth_model = ui.SimpleIntModel(int(self.current_bookshelf.depth))
ui.IntField(model=self.depth_model, width=50)
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Thickness (cm): ")
self.thickness_model = ui.SimpleIntModel(int(self.current_bookshelf.thickness))
ui.IntField(model=self.thickness_model, width=50)
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Number of Shelves: ")
self.num_shelves_model = ui.SimpleIntModel(int(self.current_bookshelf.num_shelves))
ui.IntField(model=self.num_shelves_model, width=50)
with ui.HStack(height=0, style={"margin_height":1}):
ui.Label("Randomize Book Scale:")
ui.CheckBox(model=self.randomize_book_model, width=50)
def on_click():
self.current_bookshelf.generate(
width=self.width_model.as_int,
height=self.height_model.as_int,
depth=self.depth_model.as_int,
thickness=self.thickness_model.as_int,
num_shelves=self.num_shelves_model.as_int,
randomize_scale=self.randomize_book_model.as_bool
)
ui.Button("Generate", height=40, clicked_fn=lambda: on_click())
def reload_frame(self):
self.frame.rebuild()
def destroy(self) -> None:
self._combo_changed_sub = None
self._stage_subscription.unsubscribe()
return super().destroy()
| 7,894 | Python | 46.848485 | 124 | 0.529263 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/config/extension.toml | [package]
# Semantic Versionning is used: https://semver.org/
version = "1.0.0"
# The title and description fields are primarily for displaying extension info in UI
title = "Bookshelf Generator"
description="A procedural modeling tool for creating bookshelves with arrayed books."
author = "Matias Codesal"
# Path (relative to the root) or content of readme markdown file for UI.
readme = "docs/README.md"
changelog = "docs/CHANGELOG.md"
# preview_image = ""
icon = "data/icon.png"
# Preview to show in the extension manager
preview_image = "data/preview.png"
# URL of the extension source repository.
repository = "https://github.com/mati-nvidia/omni-bookshelf-generator"
# One of categories for UI.
category = "Modeling"
# Keywords for the extension
keywords = ["modeling", "procedural", "pointinstancer", "instancing", "book", "bookshelf", "bookcase"]
# Use omni.ui to build simple UI
[dependencies]
"omni.kit.uiapp" = {}
"omni.usd" = {}
# Main python module this extension provides, it will be publicly available as "import maticodes.generator.bookshelf".
[[python.module]]
name = "maticodes.generator.bookshelf"
| 1,129 | TOML | 27.974358 | 118 | 0.74225 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/docs/CHANGELOG.md | ## [Unreleased]
## [1.0.0] - 2022-10-13
### Added
- Initial release of the Bookshelf Generator. Feature complete from the live coding sessions. | 144 | Markdown | 27.999994 | 93 | 0.715278 |
mati-nvidia/omni-bookshelf-generator/exts/maticodes.generator.bookshelf/docs/README.md | # Bookshelf Generator
A procedural modeling tool for creating bookshelves with arrayed books. You can set parameters like height, width, and number
of shelves to control the generator. The extension comes with a sample book asset or you can use your own books or props
as prototypes for the PointInstancer.
## Usage
1. Press the `Create New` button to create a new bookshelf.
2. Expand the Prototypes collapsible frame and click `Create Default Prototypes`. Optionally, you can provide your own prototypes.
1. NOTE: Prototype targets should be an Xform and the pivot should be centered on the bottom of the model.
3. Set the rest of the parameters.
4. Click `Generate`. You can change the parameters and click `Generate` again to regenerate.
**NOTE:** Use the combobox to select a different bookshelf in the stage to operate on.
**NOTE:** Use the `Reload` button to refresh the combobox.
## Attribution
Icon made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](www.flaticon.com) | 1,020 | Markdown | 55.722219 | 130 | 0.77549 |