Updates to various components, added a few new ones.

This commit is contained in:
Areloch 2019-02-24 01:50:38 -06:00
parent e0627973fb
commit dac8d6e1fd
52 changed files with 4566 additions and 1799 deletions

View file

@ -11,4 +11,9 @@
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -3,8 +3,7 @@
canSaveDynamicFields="true"
AssetName="ControlObjectComponentAsset"
componentName="ControlObjectComponent"
componentClass="Component"
componentClass="ControlObjectComponent"
friendlyName="Control Object"
componentType="Game"
description="Allows the component owner to be controlled by a client."
scriptFile="core/components/components/game/controlObject.cs" />
description="Allows the component owner to be controlled by a client." />

View file

@ -1,89 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera.");
function ControlObjectComponent::onAdd(%this)
{
%this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", "");
%clientID = %this.getClientID();
if(%clientID && !isObject(%clientID.getControlObject()))
%clientID.setControlObject(%this.owner);
}
function ControlObjectComponent::onRemove(%this)
{
%clientID = %this.getClientID();
if(%clientID)
%clientID.setControlObject(0);
}
function ControlObjectComponent::onClientConnect(%this, %client)
{
if(%this.isControlClient(%client) && !isObject(%client.getControlObject()))
%client.setControlObject(%this.owner);
}
function ControlObjectComponent::onClientDisconnect(%this, %client)
{
if(%this.isControlClient(%client))
%client.setControlObject(0);
}
function ControlObjectComponent::getClientID(%this)
{
return ClientGroup.getObject(%this.clientOwner-1);
}
function ControlObjectComponent::isControlClient(%this, %client)
{
%clientID = ClientGroup.getObject(%this.clientOwner-1);
if(%client.getID() == %clientID)
return true;
else
return false;
}
function ControlObjectComponent::onInspectorUpdate(%this, %field)
{
%clientID = %this.getClientID();
if(%clientID && !isObject(%clientID.getControlObject()))
%clientID.setControlObject(%this.owner);
}
function switchControlObject(%client, %newControlEntity)
{
if(!isObject(%client) || !isObject(%newControlEntity))
return error("SwitchControlObject: No client or target controller!");
%control = %newControlEntity.getComponent(ControlObjectComponent);
if(!isObject(%control))
return error("SwitchControlObject: Target controller has no conrol object behavior!");
%client.setControlObject(%newControlEntity);
}

View file

@ -0,0 +1,107 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(TypeMaskFieldGui) {
position = "0 0";
extent = "1024 768";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultNonModalProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
new GuiWindowCtrl(TypeMaskFieldWindow) {
text = "Select Type Masks";
resizeWidth = "0";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
canCollapse = "0";
closeCommand = "Canvas.popDialog(TypeMaskFieldGui);";
edgeSnap = "1";
docking = "None";
margin = "4 4 4 4";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "0";
anchorLeft = "0";
anchorRight = "0";
position = "430 176";
extent = "161 250";
minExtent = "161 86";
horizSizing = "windowRelative";
vertSizing = "windowRelative";
profile = "ToolsGuiWindowProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "0";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "2 0";
mouseWheelScrollSpeed = "-1";
docking = "Client";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "1 9";
extent = "159 238";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiStackControl() {
stackingType = "Vertical";
horizStacking = "Left to Right";
vertStacking = "Top to Bottom";
padding = "-2";
dynamicSize = "1";
dynamicNonStackExtent = "0";
dynamicPos = "0";
changeChildSizeToFit = "1";
changeChildPosition = "1";
position = "3 1";
extent = "153 18";
minExtent = "16 16";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "TypeMaskList";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,276 @@
function GuiInspectorComponentGroup::buildMaterialField(%this, %component, %fieldName)
{
%extent = 200;
%currentMaterial = %component.getFieldValue(%fieldName);
//if we don't have a new material set on this slot, just use the default
if(%currentMaterial $= "" || %currentMaterial == 0)
%currentMaterial = %material;
%container = new GuiControl() {
canSaveDynamicFields = "0";
Profile = "EditorContainerProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "300 110";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
};
%labelControl = new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorFontHLBold";
HorizSizing = "right";
VertSizing = "bottom";
Position = "16 3";
Extent = "100 18";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
text = %fieldName;
maxLength = "1024";
};
//
%imageContainer = new GuiControl(){
profile = "ToolsGuiDefaultProfile";
Position = "20 25";
Extent = "74 87";
HorizSizing = "right";
VertSizing = "bottom";
isContainer = "1";
new GuiTextCtrl(){
position = "7 71";
profile = "ToolsGuiTextCenterProfile";
extent = "64 16";
text = %matName;
};
};
%previewButton = new GuiBitmapButtonCtrl(){
internalName = %matName;
HorizSizing = "right";
VertSizing = "bottom";
profile = "ToolsGuiButtonProfile";
position = "7 4";
extent = "64 64";
buttonType = "PushButton";
bitmap = "";
Command = "";
text = "Loading...";
useStates = false;
tooltip = "Change material";
new GuiBitmapButtonCtrl(){
HorizSizing = "right";
VertSizing = "bottom";
profile = "ToolsGuiButtonProfile";
position = "0 0";
extent = "64 64";
Variable = "";
buttonType = "toggleButton";
bitmap = "tools/materialEditor/gui/cubemapBtnBorder";
groupNum = "0";
text = "";
tooltip = "Change material";
};
};
%previewBorder = new GuiButtonCtrl(){
className = "materialFieldBtn";
internalName = %matName@"Border";
HorizSizing = "right";
VertSizing = "bottom";
profile = "ToolsGuiThumbHighlightButtonProfile";
position = "3 0";
extent = "72 88";
Variable = "";
buttonType = "toggleButton";
tooltip = %matName;
groupNum = "0";
text = "";
Object = %component;
targetField = %fieldName;
};
%previewBorder.Command = %previewBorder @ ".getMaterialName();";
%imageContainer.add(%previewButton);
%imageContainer.add(%previewBorder);
%container.add(%imageContainer);
//
%mapToLabel = new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorFontHLBold";
HorizSizing = "right";
VertSizing = "bottom";
Position = "100 26";
Extent = %extent SPC "18";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
text = "Mapped to:" SPC %material.mapTo;
maxLength = "1024";
};
%editControl = new GuiTextEditCtrl() {
class = "BehaviorEdTextField";
internalName = %accessor @ "File";
canSaveDynamicFields = "0";
Profile = "EditorTextEdit";
HorizSizing = "right";
VertSizing = "bottom";
Position = "100 50";
Extent = %extent SPC "22";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
maxLength = "1024";
historySize = "0";
password = "0";
text = %currentMaterial;
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
precision = %precision;
accessor = %accessor;
isProperty = true;
undoLabel = %fieldName;
object = %this.object;
useWords = false;
};
%resetButton = new GuiButtonCtrl() {
canSaveDynamicFields = "0";
className = "materialFieldBtn";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "100 75";
Extent = (%extent * 0.3)-3 SPC "22";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = "Reset to default material";
tooltipProfile = "EditorToolTipProfile";
text = "Reset";
pathField = %editControl;
};
%editMatButton = new GuiButtonCtrl() {
canSaveDynamicFields = "0";
className = "materialFieldBtn";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = %resetButton.position.x + (%extent * 0.3) + 6 SPC "75";
Extent = (%extent * 0.6)-3 SPC "22";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = "Edit in Material Editor";
tooltipProfile = "EditorToolTipProfile";
text = "Open in Editor";
pathField = %editControl;
};
%container.add(%mapToLabel);
%container.add(%labelControl);
%container.add(%editControl);
%container.add(%resetButton);
%container.add(%editMatButton);
//load the material
%matName = "";
// CustomMaterials are not available for selection
/*if ( !isObject( %currentMaterial ) || %currentMaterial.isMemberOfClass( "CustomMaterial" ) )
return;*/
%assetDef = AssetDatabase.acquireAsset(%currentMaterial);
%materialDef = %assetDef.materialDefinitionName;
if( %materialDef.isMemberOfClass("TerrainMaterial") )
{
%matName = %currentMaterial.getInternalName();
if( %materialDef.diffuseMap $= "")
%previewImage = "core/art/warnmat";
else
%previewImage = %materialDef.diffuseMap;
}
else if( %materialDef.toneMap[0] $= "" && %materialDef.diffuseMap[0] $= "" && !isObject(%materialDef.cubemap) )
{
%matName = %materialDef.name;
%previewImage = "core/art/warnmat";
}
else
{
%matName = %materialDef.name;
if( %materialDef.toneMap[0] !$= "" )
%previewImage = %materialDef.toneMap[0];
else if( %materialDef.diffuseMap[0] !$= "" )
%previewImage = %materialDef.diffuseMap[0];
else if( %materialDef.cubemap.cubeFace[0] !$= "" )
%previewImage = %materialDef.cubemap.cubeFace[0];
//%previewImage = MaterialEditorGui.searchForTexture( %material, %previewImage );
// were going to use a couple of string commands in order to properly
// find out what the img src path is
// **NEW** this needs to be updated with the above, but has some timing issues
%materialDiffuse = %previewImage;
%materialPath = %materialDef.getFilename();
if( strchr( %materialDiffuse, "/") $= "" )
{
%k = 0;
while( strpos( %materialPath, "/", %k ) != -1 )
{
%foo = strpos( %materialPath, "/", %k );
%k = %foo + 1;
}
%foobar = getSubStr( %materialPath , %k , 99 );
%previewImage = strreplace( %materialPath, %foobar, %previewImage );
}
else
%previewImage = strreplace( %materialPath, %materialPath, %previewImage );
}
%previewButton.setBitmap(%previewImage);
%previewButton.setText("");
%this.stack.add(%container);
}
function materialFieldBtn::onClick(%this)
{
AssetBrowser.showDialog("MaterialAsset", "", %this.Object, %this.targetField, "");
}
function materialFieldBtn::setMaterial(%this, %matAssetName)
{
}

View file

@ -0,0 +1,215 @@
function BehaviorFieldStack::createStateMachineEditor(%this, %behavior, %fieldIndex)
{
%fieldInfo = %behavior.template.getBehaviorField(%fieldIndex);
%name = getField(%fieldInfo, 0);
%button = new GuiButtonCtrl()
{
class = EditStateMachineBtn;
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 2";
Extent = (%this.extent.x - 8) SPC 13;
text = "Edit States";
tooltip = "Open window to edit the state machine";
behavior = %behavior;
};
%this.add(%button);
}
function EditStateMachineBtn::onClick(%this)
{
Canvas.pushDialog(StateMachineEditor);
StateMachineEditor.behavior = %this.behavior;
StateMachineEditor.open();
}
function StateMachineEditor::open(%this)
{
//check our behavior and see if we have any existing state/field info to work with
//if we do, load those up first
for(%i = 0; %i < %this.behavior.stateMachine.count(); %i++)
{
%stateName = %this.behavior.stateMachine.getKey(%i);
%this.addState(%stateName);
}
}
function StateMachineEditor::addState(%this, %stateName)
{
if(%stateName $= "")
%stateName = "New State";
%state = new GuiControl() {
position = "0 0";
extent = "285 50";
horizSizing = "horizResizeWidth";
vertSizing = "vertResizeTop";
isContainer = "1";
new GuiTextEditCtrl() {
position = "0 0";
extent = "100 15";
text = %stateName;
};
new GuiButtonCtrl() {
//buttonMargin = "4 4";
text = "Remove State";
position = "184 0";
extent = "100 15";
//profile = "GuiButtonProfile";
command = "ScriptEditorGui.save();";
};
new GuiSeparatorCtrl() {
position = "0 15";
extent = %this.extent.x SPC "10";
type = "horizontal";
};
new GuiStackControl(%stateName@"StateStack")
{
//Profile = "EditorContainerProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 25";
Extent = "285 20";
padding = 4;
new GuiButtonCtrl() {
text = "Add field";
position = "3 0";
extent = "280 20";
horizSizing = "left";
vertSizing = "top";
command = "StateMachineEditor.addField("@%stateName@");";
};
};
};
%this-->Stack.add(%state);
//%this-->stateStackScroll.computeSizes();
}
function StateMachineEditor::addField(%this, %stateName)
{
%index = %this.behavior.stateMachine.count();
%field = new GuiControl() {
position = "0 0";
extent = "285 20";
horizSizing = "width";
vertSizing = "height";
isContainer = "1";
fieldValueCtrl = "";
fieldID = %index++;
};
%fieldList = new GuiPopUpMenuCtrlEx()
{
class = "stateMachineFieldList";
Profile = "GuiPopupMenuProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 1";
Extent = "120 18";
behavior = %this.behavior;
};
%field.add(%fieldList);
%fieldList.refresh();
(%stateName@"StateStack").addToStack(%field);
%this-->Stack.updateStack();
%this-->stateStackScroll.computeSizes();
%this.behavior.addStateField(%stateName, "", "");
return %field;
}
//==============================================================================
function stateMachineFieldList::refresh(%this)
{
%this.clear();
// Find all the types.
%count = getWordCount(%this.behavior.stateFields);
%index = 0;
for (%j = 0; %j < %count; %j++)
{
%item = getWord(%this.behavior.stateFields, %j);
%this.add(%item, %index);
%this.fieldType[%index] = %item;
%index++;
}
}
function stateMachineFieldList::onSelect(%this)
{
//if(%this.getParent().fieldValueCtrl $= "")
%this.fieldType = %this.fieldType[%this.getSelected()];
if(%this.fieldType $= "transitionOnAnimEnd" || %this.fieldType $= "transitionOnAnimTrigger"
|| %this.fieldType $= "transitionOnTimeout")
{
%fieldCtrl = new GuiPopUpMenuCtrlEx()
{
class = "stateMachineFieldList";
Profile = "GuiPopupMenuProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "124 1";
Extent = "120 18";
};
}
else if(%this.fieldType $= "animation")
{
%fieldCtrl = new GuiPopUpMenuCtrlEx()
{
class = "stateMachineFieldList";
Profile = "GuiPopupMenuProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "124 1";
Extent = "120 18";
};
%index = 0;
%animBhvr = %this.behavior.owner.getBehavior("AnimationController");
for(%i = 0; %i < %animBhvr.getAnimationCount(); %i++)
{
%item = %animBhvr.getAnimationName(%i);
%fieldCtrl.add(%item, %index);
%fieldCtrl.fieldValue[%index] = %item;
%index++;
}
}
else
{
%fieldCtrl = new GuiTextEditCtrl() {
position = "124 1";
extent = "120 10";
text = "";
};
}
//get the state machine entry
%index = %this.getParent().fieldID;
%oldValue = %this.behavior.stateMachine.getValue(%index);
%this.behavior.stateMachine.setValue(%fieldType SPC %oldValue.y);
%this.getParent().add(%fieldCtrl);
}
//==============================================================================
//Now for the unique field types
/*function stateMachineFieldList::refresh(%this)
{
}*/

View file

@ -0,0 +1,40 @@
function GuiInspectorComponentGroup::buildTypeMaskField(%this, %component, %fieldName)
{
%extent = 200;
%container = new GuiControl() {
canSaveDynamicFields = "0";
Profile = "EditorContainerProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "300 110";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
};
%labelControl = new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorFontHLBold";
HorizSizing = "right";
VertSizing = "bottom";
Position = "16 3";
Extent = "100 18";
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
text = %fieldName;
maxLength = "1024";
};
%container.add(%container);
%this.stack.add(%container);
}

View file

@ -22,7 +22,14 @@
//Scripts
exec("./scripts/componentEditor.ed.cs");
exec("./scripts/stateMachineEditor.ed.cs");
exec("./scripts/superToolTipDlg.ed.cs");
//gui
exec("./gui/superToolTipDlg.ed.gui");
exec("./gui/stateMachineDlg.ed.gui");
//field types
exec("./interface/materialFieldType.cs");
exec("./interface/typeMaskFieldType.cs");
exec("./interface/stateMachineField.cs");

View file

@ -154,13 +154,13 @@ function QuickEditComponentList::onHotTrackItem( %this, %itemID )
SuperTooltipDlg.setTitle(%componentObj.friendlyName);
SuperTooltipDlg.addParam("", %componentObj.description @ "\n");
/*%fieldCount = %componentObj.getComponentFieldCount();
%fieldCount = %componentObj.getComponentFieldCount();
for (%i = 0; %i < %fieldCount; %i++)
{
%name = getField(%componentObj.getComponentField(%i), 0);
SuperTooltipDlg.addParam(%name, %description @ "\n");
}*/
}
%position = %this.getGlobalPosition();
SuperTooltipDlg.processTooltip( %position,0,1 );
%this.opened = true;