Skip to content

Commit

Permalink
Asset Admin: Now with a Frame Set!
Browse files Browse the repository at this point in the history
This adds the Frame Set to the Asset Admin. It also fixes a few bugs with centering.
  • Loading branch information
greenfire27 committed Sep 13, 2023
1 parent 3030ca5 commit 359c92a
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 70 deletions.
144 changes: 118 additions & 26 deletions editor/AssetAdmin/AssetAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,79 @@
exec("./ImageEditor/exec.cs");

%this.guiPage = EditorCore.RegisterEditor("Asset Manager", %this);
%this.guiPage.add(%this.buildAssetWindow());
%this.guiPage.add(%this.buildAudioPlayButton());
%this.guiPage.add(%this.buildLibrary());
%this.guiPage.add(%this.buildInspector());
%this.content = %this.createFrameSet();
%this.buildAssetWindow();
%this.buildAudioPlayButton();
%this.buildInspector();
%this.buildLibrary();

EditorCore.FinishRegistration(%this.guiPage);

%this.isOpen = false;
}

function AssetAdmin::createFrameSet(%this)
{
%content = new GuiFrameSetCtrl() {
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = %this.guiPage.getExtent();
DividerThickness = 6;
};
ThemeManager.setProfile(%content, "frameSetProfile");
ThemeManager.setProfile(%content, "dropButtonProfile", "dropButtonProfile");
ThemeManager.setProfile(%content, "frameSetTabBookProfile", "tabBookProfile");
ThemeManager.setProfile(%content, "frameSetTabProfile", "tabProfile");
ThemeManager.setProfile(%content, "frameSetTabPageProfile", "tabPageProfile");
%this.guiPage.add(%content);

%idList = %content.createHorizontalSplit(1);
%leftID = getWord(%idList, 0);
%rightID = getWord(%idList, 1);
%content.anchorFrame(%rightID);
%content.setFrameSize(%rightID, 324);

%ids = %content.createVerticalSplit(%leftID);
%centerFrameID = getWord(%ids, 0);
%inspectorFrameID = getWord(%ids, 1);
%content.anchorFrame(%inspectorFrameID);
%content.setFrameSize(%inspectorFrameID, 360);

return %content;
}

function AssetAdmin::buildLibrary(%this)
{
%this.libWindow = new GuiWindowCtrl()
{
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "330 380";
MinExtent = "100 100";
text = "Asset Library";
canMove = true;
canClose = false;
canMinimize = true;
canMaximize = false;
resizeWidth = true;
resizeHeight = true;
};
ThemeManager.setProfile(%this.libWindow, "windowProfile");
ThemeManager.setProfile(%this.libWindow, "windowContentProfile", "ContentProfile");
ThemeManager.setProfile(%this.libWindow, "windowButtonProfile", "CloseButtonProfile");
ThemeManager.setProfile(%this.libWindow, "windowButtonProfile", "MinButtonProfile");
ThemeManager.setProfile(%this.libWindow, "windowButtonProfile", "MaxButtonProfile");
%this.content.add(%this.libWindow);

%this.libScroller = new GuiScrollCtrl()
{
HorizSizing="left";
VertSizing="height";
Position="700 0";
Extent="324 768";
MinExtent="162 384";
HorizSizing = "width";
VertSizing = "height";
Position="0 0";
Extent="324 356";
MinExtent="0 0";
hScrollBar="dynamic";
vScrollBar="alwaysOn";
constantThumbHeight="0";
Expand All @@ -67,11 +121,12 @@
ThemeManager.setProfile(%this.libScroller, "scrollingPanelThumbProfile", ThumbProfile);
ThemeManager.setProfile(%this.libScroller, "scrollingPanelTrackProfile", TrackProfile);
ThemeManager.setProfile(%this.libScroller, "scrollingPanelArrowProfile", ArrowProfile);
%this.libWindow.add(%this.libScroller);

%this.dictionaryList = new GuiChainCtrl()
{
HorizSizing="right";
VertSizing="bottom";
HorizSizing="width";
VertSizing="height";
Position="0 0";
Extent="310 768";
MinExtent="220 200";
Expand All @@ -85,8 +140,6 @@
%this.dictionaryList.add(%this.buildDictionary("Fonts", "FontAsset"));
%this.dictionaryList.add(%this.buildDictionary("Audio", "AudioAsset"));
//%this.dictionaryList.add(%this.buildDictionary("Spines", "SpineAsset"));

return %this.libScroller;
}

function AssetAdmin::buildDictionary(%this, %title, %type)
Expand All @@ -96,10 +149,10 @@
Class = AssetDictionary;
Text=%title;
command="";
HorizSizing="right";
HorizSizing="width";
VertSizing="bottom";
Position="0 0";
Extent="310 22";
Extent="306 22";
MinExtent="80 22";
Type = %type;
};
Expand All @@ -111,22 +164,61 @@

function AssetAdmin::buildInspector(%this)
{
%this.inspectorWindow = new GuiWindowCtrl()
{
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "706 380";
MinExtent = "100 100";
text = "Asset Inspector";
canMove = true;
canClose = false;
canMinimize = true;
canMaximize = false;
resizeWidth = true;
resizeHeight = true;
};
ThemeManager.setProfile(%this.inspectorWindow, "windowProfile");
ThemeManager.setProfile(%this.inspectorWindow, "windowContentProfile", "ContentProfile");
ThemeManager.setProfile(%this.inspectorWindow, "windowButtonProfile", "CloseButtonProfile");
ThemeManager.setProfile(%this.inspectorWindow, "windowButtonProfile", "MinButtonProfile");
ThemeManager.setProfile(%this.inspectorWindow, "windowButtonProfile", "MaxButtonProfile");
%this.content.add(%this.inspectorWindow);

%this.inspector = new GuiControl()
{
class = "AssetInspector";
HorizSizing="width";
VertSizing="top";
Position="0 444";
Extent="700 324";
HorizSizing = "width";
VertSizing = "height";
Position="0 0";
Extent="700 370";
MinExtent="350 222";
};
ThemeManager.setProfile(%this.inspector, "overlayProfile");

return %this.inspector;
%this.inspectorWindow.add(%this.inspector);
}

function AssetAdmin::buildAssetWindow(%this)
{
%this.background = new GuiSpriteCtrl() {
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "100 100";
imageColor = "255 255 255 255";
Image = "EditorCore:editorGrid";
singleFrameBitmap = "1";
tileImage = "1";
positionOffset = "0 0";
imageSize = "128 128";
fullSize = "0";
constrainProportions = "1";
};
ThemeManager.setProfile(%this.background, "emptyProfile");
%this.content.add(%this.background);

%this.assetScene = new Scene();
%this.assetScene.setScenePause(true);

Expand All @@ -135,9 +227,9 @@ class = "AssetInspector";
class = AssetWindow;
profile = ThemeManager.activeTheme.overlayProfile;
position = "0 0";
extent = "700 444";
HorizSizing="width";
VertSizing="height";
extent = %this.background.extent;
HorizSizing = "width";
VertSizing = "height";
minExtent = "0 0";
cameraPosition = "0 0";
cameraSize = "175 111";
Expand All @@ -156,15 +248,15 @@ class = AssetWindow;
%this.assetWindow.setShowScrollBar(true);
%this.assetWindow.setMouseWheelScrolls(false);

return %this.assetWindow;
%this.background.add(%this.assetWindow);
}

function AssetAdmin::buildAudioPlayButton(%this)
{
%this.audioPlayButtonContainer = new GuiControl()
{
position = "0 0";
extent = "700 444";
extent = %this.background.extent;
HorizSizing="width";
VertSizing="height";
Visible="0";
Expand All @@ -182,7 +274,7 @@ class = AssetWindow;
ThemeManager.setProfile(%this.audioPlayButton, "buttonProfile");
%this.audioPlayButtonContainer.add(%this.audioPlayButton);

return %this.audioPlayButtonContainer;
%this.background.add(%this.audioPlayButtonContainer);
}

function AssetAdmin::destroy(%this)
Expand Down
4 changes: 4 additions & 0 deletions editor/AssetAdmin/AssetDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
class = "NewAssetButton";
Position = "5 27";
Extent = "300 30";
HorizSizing = "width";
VertSizing = "height";
Text = "New";
};
ThemeManager.setProfile(%this.newButton, "buttonProfile");
Expand All @@ -36,6 +38,8 @@ class = "NewAssetButton";
{
Position="0 62";
Extent = "310 50";
HorizSizing = "width";
VertSizing = "height";
CellSizeX = 60;
CellSizeY = 60;
CellModeX = variable;
Expand Down
13 changes: 6 additions & 7 deletions editor/AssetAdmin/AssetInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
%this.titlebar = new GuiControl()
{
HorizSizing="width";
VertSizing="top";
VertSizing="bottom";
Position="0 0";
Extent="700 34";
MinExtent="350 34";
MinExtent="0 34";
Text = "";
};
ThemeManager.setProfile(%this.titlebar, "panelProfile");
Expand Down Expand Up @@ -88,8 +88,7 @@
HorizSizing = width;
VertSizing = height;
Position = "0 34";
Extent = "700 290";
MinExtent="350 290";
Extent = "700 320";
TabPosition = top;
Visible = false;
};
Expand Down Expand Up @@ -128,7 +127,7 @@
HorizSizing = width;
VertSizing = height;
Position = "0 0";
Extent = "700 290";
Extent = "700 320";
Text = %name;
};
ThemeManager.setProfile(%page, "tabPageProfile");
Expand All @@ -143,7 +142,7 @@
HorizSizing="width";
VertSizing="height";
Position="0 0";
Extent="700 290";
Extent="700 320";
hScrollBar="alwaysOff";
vScrollBar="alwaysOn";
constantThumbHeight="0";
Expand All @@ -165,7 +164,7 @@
HorizSizing="width";
VertSizing="height";
Position="0 0";
Extent="686 290";
Extent="686 320";
FieldCellSize="300 40";
ControlOffset="10 18";
ConstantThumbHeight=false;
Expand Down
6 changes: 3 additions & 3 deletions editor/EditorCore/EditorIconButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
constrainProportions = "1";
fullSize = "0";
Image = "EditorCore:EditorIcons16";
ImageSize = "18 18";
ImageSize = "16 16";
ImageColor = ThemeManager.activeTheme.iconButtonProfile.FontColor;
Frame = %this.frame;
Tooltip = %this.Tooltip;
Expand All @@ -32,13 +32,13 @@
function EditorIconButton::onTouchEnter(%this)
{
%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColorHL, 200, "EaseInOut");
%this.icon.growTo("20 20", 200, "EaseInOut");
%this.icon.growTo("18 18", 200, "EaseInOut");
}

function EditorIconButton::onTouchLeave(%this)
{
%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColor, 200, "EaseInOut");
%this.icon.growTo("18 18", 200, "EaseInOut");
%this.icon.growTo("16 16", 200, "EaseInOut");
}

function EditorIconButton::onTouchDown(%this)
Expand Down
4 changes: 4 additions & 0 deletions editor/EditorCore/images/editorGrid.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ImageAsset
AssetName="editorGrid"
ImageFile="editorGrid.png"
AssetInternal="1" />
Binary file added editor/EditorCore/images/editorGrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 359c92a

Please sign in to comment.