Skip to content

Commit

Permalink
Display short prefab names in treeview
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Nov 1, 2024
1 parent b44c800 commit 4129742
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions etc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<script src="flecs.js" type="text/javascript" charset="utf-8"></script>

<!-- Application source -->
<script src="js/common.js"></script>
<script src="js/module_loader.js"></script>
<script src="js/app.js"></script>
</body>
Expand Down
8 changes: 8 additions & 0 deletions etc/js/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
explorer = {
shortenEntity: function(entity) {
let escaped = entity.replaceAll("\\.", "@@");
escaped = escaped.split(".").pop();
escaped = escaped.replaceAll("@@", ".");
return escaped;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ const nameIsPair = computed(() => {
});
function shortenEntity(entity) {
let escaped = entity.replaceAll("\\.", "@@");
escaped = escaped.split(".").pop();
escaped = escaped.replaceAll("@@", ".");
return escaped;
return explorer.shortenEntity(entity);
}
function removeComponent() {
Expand Down
6 changes: 5 additions & 1 deletion etc/js/components/widgets/tree/entity-tree-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
<div class="entity-tree-item-name noselect">
<span>
{{ itemName }}<template v-if="item.baseEntity"><span class="entity-tree-item-base">&nbsp;:&nbsp;{{ item.baseEntity }}</span></template>
{{ itemName }}<template v-if="item.baseEntity"><span class="entity-tree-item-base">&nbsp;:&nbsp;{{ shortenEntity(item.baseEntity) }}</span></template>
</span>
</div>
</div>
Expand Down Expand Up @@ -100,6 +100,10 @@ const chevronRotation = computed(() => {
}
});
function shortenEntity(entity) {
return explorer.shortenEntity(entity);
}
</script>

<style scoped>
Expand Down

0 comments on commit 4129742

Please sign in to comment.