4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00
nerfstudio/nerfactory/viewer/server/path.py
Ethan Weber 73fedc7593
Viewer refactor with state sync (#212)
* initial commit for viewer refactor

* updating name change to nerfactory

* adding headers

* making the rendering fix which broke from a merge

* things are starting to work. removing old commands now

* removed prints

* cleanup

* updating state works now even for nested dictionaries

* updating state in redux. listening for state changes. trying to draw three.js now

* added drawing functionality. need to fix translation of frustums and image planes

* images and frustums drawn correctly

* fixing lint

* github actions

* back to npm

* fixing eslint

* remove package.json from root

* new favicon

* some viewer cleanup

* notebook

* fixed camera drawings speed to avoid redraw

* trying to get Leva to update

* quick fix

* synced config panel

* adding notebook

* fixing output print error
2022-08-02 16:02:07 -05:00

59 lines
1.5 KiB
Python

# Copyright 2022 The Plenoptix Team. All rights reserved.
#
# 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.
"""Path class
"""
from typing import Tuple
UNICODE = str
class Path:
"""Path class
Args:
entries: component parts of the path
"""
__slots__ = ["entries"]
def __init__(self, entries: Tuple = tuple()):
self.entries = entries
def append(self, other: str) -> "Path":
"""Methodthat appends a new component and returns new Path
Args:
other: _description_
"""
new_path = self.entries
for element in other.split("/"):
if len(element) == 0:
new_path = tuple()
else:
new_path = new_path + (element,)
return Path(new_path)
def lower(self):
"""Convert path object to serializable format"""
return UNICODE("/" + "/".join(self.entries))
def __hash__(self):
return hash(self.entries)
def __eq__(self, other):
return self.entries == other.entries