(Mostly) updated verve implementation.

This commit is contained in:
Areloch 2019-03-07 16:23:41 -06:00
parent 775ca57047
commit 87ee749801
538 changed files with 68727 additions and 49 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -0,0 +1,12 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
singleton GuiControlProfile( VPathEditorProfile )
{
CanKeyFocus = true;
FontType = "Arial Bold";
FontColor = "0 0 0";
};

View file

@ -0,0 +1,434 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
new VPathEditor(EVPathEditor) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "VPathEditorProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Docking = "None";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "0";
AnchorBottom = "0";
AnchorLeft = "0";
AnchorRight = "0";
cameraZRot = "0";
forceFOV = "0";
renderMissionArea = "1";
missionAreaFillColor = "255 0 0 20";
missionAreaFrameColor = "255 0 0 128";
allowBorderMove = "0";
borderMovePixelSize = "20";
borderMoveSpeed = "0.1";
consoleFrameColor = "255 0 0 255";
consoleFillColor = "0 0 0 0";
consoleSphereLevel = "1";
consoleCircleSegments = "32";
consoleLineWidth = "1";
GizmoProfile = "GlobalGizmoProfile";
new GuiWindowCollapseCtrl(VPathEditorTreeWindow) {
internalName = "";
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209
SPC getWord(EditorGuiToolbar.extent, 1) - 1;
Extent = "210 167";
MinExtent = "210 100";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "EditorGui.setEditor( WorldEditorInspectorPlugin );";
EdgeSnap = "1";
text = "Path Editor";
new GuiContainer(){
profile = GuiDefaultProfile;
Position = "5 25";
Extent = "200 120";
Docking = "Client";
Margin = "3 1 3 3 ";
HorizSizing = "width";
VertSizing = "height";
isContainer = "1";
new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiEditorScrollProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "200 118";
MinExtent = "8 8";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Docking = "Client";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "true";
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
new GuiTreeViewCtrl(VPathTreeView) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "ToolsGuiTreeViewProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "1 1";
Extent = "193 21";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
tabSize = "16";
textOffset = "2";
fullRowSelect = "0";
itemHeight = "21";
destroyTreeOnSleep = "1";
MouseDragging = "0";
MultipleSelections = "0";
DeleteObjectAllowed = "1";
DragToItemAllowed = "0";
showRoot = "1";
internalNamesOnly = "0";
};
};
};
new GuiBitmapButtonCtrl() {
bitmap = "tools/gui/images/delete";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "193 4";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "VPathTreeView.DeleteSelectedPaths();";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Delete Selected Path";
hovertime = "1000";
internalName = "deleteSelection";
canSaveDynamicFields = "0";
};
new GuiBitmapButtonCtrl() {
bitmap = "core/art/gui/images/new";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "176 3";
Extent = "17 17";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "VPathTreeView.CreatePath();";
tooltipprofile = "GuiToolTipProfile";
tooltip = "Create New Path";
hovertime = "1000";
internalName = "CreateSelection";
canSaveDynamicFields = "0";
};
};
new GuiWindowCollapseCtrl(VPathEditorOptionsWindow) {
internalName = "Window";
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209
SPC getWord(EditorGuiToolbar.extent, 1) + getWord(VPathEditorTreeWindow.extent, 1) - 2;
Extent = "210 530";
MinExtent = "210 298";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "EditorGui.setEditor( WorldEditorPlugin );";
EdgeSnap = "1";
text = "Properties";
new GuiContainer(){ //Node Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "4 24";
Extent = "202 127";
Docking = "Top";
Margin = "3 3 3 3";
new GuiTextCtrl(){
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "5 0";
Extent = "86 18";
text = "Node Properties";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "7 21";
Extent = "46 18";
text = "Position";
};
new GuiTextEditCtrl(){
internalName = "position";
Profile = "GuiTextEditProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "57 21";
Extent = "141 18";
text = "";
AltCommand = "EVPathEditor.setNodePosition( $ThisControl.getValue() );";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "7 42";
Extent = "46 18";
text = "Rotation";
};
new GuiTextEditCtrl(){
internalName = "rotation";
Profile = "GuiTextEditProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "57 42";
Extent = "141 18";
text = "";
AltCommand = "EVPathEditor.setNodeRotation( $ThisControl.getValue() );";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "7 63";
Extent = "46 18";
text = "Weight";
};
new GuiTextEditCtrl(){
internalName = "weight";
Profile = "GuiTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "57 63";
Extent = "52 18";
text = "";
AltCommand = "EVPathEditor.setNodeWeight( $ThisControl.getValue() );";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "7 84";
Extent = "46 18";
text = "Orientation";
};
new GuiPopUpMenuCtrl(EPathEditorNodeOrientationMode){
internalName = "weight";
Profile = "GuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "57 84";
Extent = "141 18";
text = "";
Command = "OnOrientationChanged();";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "7 105";
Extent = "46 18";
text = "Lookat Pt";
};
new GuiTextEditCtrl(EPathEditorNodeOrientationData){
internalName = "weight";
Profile = "GuiTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "57 105";
Extent = "141 18";
text = "";
AltCommand = "OnOrientationChanged();";
};
};
new GuiContainer(){ // Path Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "4 112";
Extent = "202 31";
Docking = "Top";
Margin = "0 0 3 3";
new GuiTextCtrl(){
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "5 0";
Extent = "121 18";
text = "Path Properties";
};
};
new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiEditorScrollProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "4 150";
Extent = "223 315";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Docking = "Client";
Margin = "-14 41 3 3";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "true";
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiInspector(VPathInspector) {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "1";
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiTransparentProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "1 1";
Extent = "179 16";
MinExtent = "16 16";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
dividerMargin = "5";
};
};
new GuiMLTextCtrl(VPathFieldInfoControl) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiInspectorFieldInfoMLTextProfile";
HorizSizing = "width";
VertSizing = "top";
Position = "1 485";
Extent = "202 42";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
useURLMouseCursor = "0";
};
};
};
//--- OBJECT WRITE END ---
function EPathEditorNodeOrientationMode::onWake( %this )
{
if ( %this.size() == 0 )
{
%this.add( "FREE", 0 );
%this.add( "TOPOINT", 1 );
}
}
function OnOrientationChanged()
{
%mode = EPathEditorNodeOrientationMode.getText();
%data = EPathEditorNodeOrientationData.getText();
EVPathEditor.setNodeOrientationMode( %mode, %data );
}

View file

@ -0,0 +1,176 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
%paletteId = new GuiControl(VPathEditorPalette) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiBitmapButtonCtrl(EVPathEditorSelectButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Select Path / Node (1)";
hovertime = "1000";
bitmap = "tools/gui/images/menubar/arrow";
buttonType = "RadioButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(EVPathEditorMoveButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Move Point (2)";
hovertime = "1000";
bitmap = "tools/worldEditor/images/road-river/move-point";
buttonType = "RadioButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(EVPathEditorRotateButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "28 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Rotate Point (3)";
hovertime = "1000";
bitmap = "tools/worldEditor/images/road-river/rotate-point";
buttonType = "RadioButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(EVPathEditorScaleButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "56 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Scale Point (4)";
hovertime = "1000";
bitmap = "tools/worldEditor/images/road-river/scale-point";
buttonType = "RadioButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(EVPathEditorAddNodeButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "28 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Add Node (5)";
hovertime = "1000";
bitmap = "tools/worldEditor/images/road-river/add-point";
buttonType = "RadioButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(EVPathEditorDeleteNodeButton) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "56 0";
Extent = "25 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
ToolTip = "Delete Node (6)";
hovertime = "1000";
bitmap = "tools/worldEditor/images/road-river/subtract-point";
buttonType = "RadioButton";
useMouseEvents = "0";
};
};
//-----------------------------------------------------------------------------
function EVPathEditorSelectButton::onClick( %this )
{
EVPathEditor.EditMode = "Gizmo";
GlobalGizmoProfile.Mode = "Select";
}
function EVPathEditorMoveButton::onClick( %this )
{
EVPathEditor.EditMode = "Gizmo";
GlobalGizmoProfile.Mode = "Move";
}
function EVPathEditorRotateButton::onClick( %this )
{
EVPathEditor.EditMode = "Gizmo";
GlobalGizmoProfile.Mode = "Rotate";
}
function EVPathEditorScaleButton::onClick( %this )
{
EVPathEditor.EditMode = "Gizmo";
GlobalGizmoProfile.Mode = "Scale";
}
function EVPathEditorAddNodeButton::onClick( %this )
{
EVPathEditor.EditMode = "AddNode";
}
function EVPathEditorDeleteNodeButton::onClick( %this )
{
EVPathEditor.EditMode = "DeleteNode";
}

View file

@ -0,0 +1,72 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
%guiContent = new GuiControl(VPathEditorToolbar)
{
canSaveDynamicFields = "0";
internalName = "VPathEditorToolbar";
Enabled = "1";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "306 0";
Extent = "800 32";
MinExtent = "8 2";
canSave = "1";
Visible = "0";
hovertime = "1000";
canMove = "0";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
resizeWidth = "0";
resizeHeight = "0";
EdgeSnap = "0";
text ="";
new GuiTextCtrl()
{
internalName = "ToolbarLabel";
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 7";
extent = "77 16";
minExtent = "8 8";
visible = "1";
text = " VPath Settings";
maxLength = "255";
helpTag = "0";
};
new GuiPopUpMenuCtrl(VPathEditorToolbarPathTypeMenu)
{
canSaveDynamicFields = "0";
internalName = "PathTypeMenu";
Enabled = "1";
isContainer = "0";
Profile = "GuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "85 7";
Extent = "70 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
maxLength = "1024";
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
};
};

View file

@ -0,0 +1,228 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
function EVPathEditor::onDeleteKey( %this )
{
%editPath = EVPathEditor.getSelectedPath();
%editNode = EVPathEditor.getSelectedNode();
if ( isObject( %editPath ) && %editNode != -1 )
{
// Delete the Node.
%this.deleteSelection();
}
else
{
// Clear Selection.
%this.clearSelection();
// Delete the Path.
MEDeleteUndoAction::submit( %editPath );
}
}
function EVPathEditor::onUpdateSelection( %this, %editPath, %editNode )
{
// Clear World Editor Selection.
EWorldEditor.clearSelection();
%clearNode = true;
if ( isObject( %editPath ) )
{
// Reset Type.
VPathEditorToolbarPathTypeMenu.setText( %editPath.PathType );
// Set World Editor Selection.
EWorldEditor.selectObject( %editPath );
// Inspect.
VPathInspector.inspect( %editPath );
// Update the Node Inspector.
if ( %editNode != -1 )
{
// Valid Node.
%clearNode = false;
VPathEditorOptionsWindow-->position.setActive( true );
VPathEditorOptionsWindow-->position.setValue( %editPath.getNodeLocalPosition( %editNode ) );
VPathEditorOptionsWindow-->rotation.setActive( true );
VPathEditorOptionsWindow-->rotation.setValue( %editPath.getNodeLocalRotation( %editNode ) );
VPathEditorOptionsWindow-->weight.setActive( true );
VPathEditorOptionsWindow-->weight.setValue( %editPath.getNodeWeight( %editNode ) );
%orientationMode = %editPath.getNodeOrientationMode( %editNode );
%orientationType = EPathEditorNodeOrientationMode.findText( strupr( getField( %orientationMode, 0 ) ) );
%orientationData = getField( %orientationMode, 1 );
EPathEditorNodeOrientationMode.setSelected( %orientationType, false );
EPathEditorNodeOrientationData.Text = %orientationData;
}
}
// Invalid Node?
if ( %clearNode )
{
VPathEditorOptionsWindow-->position.setActive( false );
VPathEditorOptionsWindow-->position.setValue( "" );
VPathEditorOptionsWindow-->rotation.setActive( true );
VPathEditorOptionsWindow-->rotation.setValue( "" );
VPathEditorOptionsWindow-->weight.setActive( true );
VPathEditorOptionsWindow-->weight.setValue( "" );
}
}
function VPathEditorToolbarPathTypeMenu::onSelect( %this )
{
%editPath = EVPathEditor.getSelectedPath();
if ( isObject( %editPath ) )
{
// Apply Type.
%editPath.PathType = %this.getText();
}
}
function VPathTreeView::onInspect( %this, %object )
{
// VPath?
if ( !%object.isMemberOfClass( "VPath" ) )
{
return;
}
// Select Object.
EVPathEditor.setSelection( %object );
}
function VPathTreeView::DeleteSelectedPaths( %this )
{
// Clear the Selection.
EVPathEditor.clearSelection();
// Iterate over Selection.
%selectionList = %this.getSelectedItemList();
%selectionCount = getWordCount( %selectionList );
for ( %i = 0; %i < %selectionCount; %i++ )
{
// Fetch Index.
%itemIndex = getWord( %selectionList, %i );
// Fetch Object.
%itemObject = %this.getItemValue( %itemIndex );
// Skip Non-Path Objects.
if ( !%itemObject.isMemberOfClass( "VPath" ) )
{
continue;
}
// Delete the Object.
MEDeleteUndoAction::submit( %itemObject );
}
// Clear the Selection.
%this.clearSelection();
EVPathEditor.clearSelection();
// Build the Tree.
%this.open( GetServerPathSet(), true );
}
function VPathTreeView::CreatePath( %this )
{
// Create Path Object.
EWCreatorWindow.createObject( "ObjectBuilderGui.buildObject( \"VPath\" );" );
}
//-----------------------------------------------------------------------------
//
// Node Editing
//
//-----------------------------------------------------------------------------
function EVPathEditor::onUpdateNode( %this, %editPath, %editNode, %selected )
{
if ( %selected )
{
%this.onUpdateNodePosition( %editPath, %editNode, %selected );
%this.onUpdateNodeRotation( %editPath, %editNode, %selected );
%this.onUpdateNodeWeight( %editPath, %editNode, %selected );
%this.onUpdateNodeOrientation( %editPath, %editNode, %selected );
}
}
function EVPathEditor::onUpdateNodePosition( %this, %editPath, %editNode, %selected )
{
if ( %selected )
{
VPathEditorOptionsWindow-->position.setValue( %editPath.getNodeLocalPosition( %editNode ) );
}
}
function EVPathEditor::onUpdateNodeRotation( %this, %editPath, %editNode, %selected )
{
if ( %selected )
{
VPathEditorOptionsWindow-->rotation.setValue( %editPath.getNodeLocalRotation( %editNode ) );
}
}
function EVPathEditor::onUpdateNodeWeight( %this, %editPath, %editNode, %selected )
{
if ( %selected )
{
VPathEditorOptionsWindow-->weight.setValue( %editPath.getNodeWeight( %editNode ) );
}
}
function EVPathEditor::onUpdateNodeOrientation( %this, %editPath, %editNode, %selected )
{
if ( %selected )
{
%orientationMode = %editPath.getNodeOrientationMode( %editNode );
%orientationType = EPathEditorNodeOrientationMode.findText( strupr( getField( %orientationMode, 0 ) ) );
%orientationData = getField( %orientationMode, 1 );
// Change?
if ( EPathEditorNodeOrientationMode.getSelected() != %orientationType )
{
// Update.
EPathEditorNodeOrientationMode.setSelected( %orientationType );
}
// Change?
if ( EPathEditorNodeOrientationData.getText() !$= %orientationData )
{
// Update.
EPathEditorNodeOrientationData.setText( %orientationData );
}
}
}
//-----------------------------------------------------------------------------
//
// Inspector
//
//-----------------------------------------------------------------------------
function VPathInspector::inspect( %this, %obj )
{
VPathFieldInfoControl.setText( "" );
Parent::inspect( %this, %obj );
}
function VPathInspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue )
{
// Same work to do as for the regular WorldEditor Inspector.
Inspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue );
}
function VPathInspector::onFieldSelected( %this, %fieldName, %fieldTypeStr, %fieldDoc )
{
VPathFieldInfoControl.setText( "<font:ArialBold:14>" @ %fieldName @ "<font:ArialItalic:14> (" @ %fieldTypeStr @ ") " NL "<font:Arial:14>" @ %fieldDoc );
}

View file

@ -0,0 +1,178 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
new ScriptObject( VPathEditorPlugin )
{
SuperClass = "EditorPlugin";
};
//-----------------------------------------------------------------------------
function VPathEditorPlugin::onWorldEditorStartup( %this )
{
//----------------------------------------------------------------------
//
// Editor Init
//
//----------------------------------------------------------------------
EditorGui.add( EVPathEditor );
EVPathEditor.setVisible( false );
%this.EditorMap = new ActionMap();
%this.EditorMap.bindCmd( keyboard, "backspace", "EVPathEditor.onDeleteKey();", "" );
%this.EditorMap.bindCmd( keyboard, "delete", "EVPathEditor.onDeleteKey();", "" );
%this.EditorMap.bindCmd( keyboard, "1", "EVPathEditorSelectButton.performClick();", "" );
%this.EditorMap.bindCmd( keyboard, "2", "EVPathEditorMoveButton.performClick();", "" );
%this.EditorMap.bindCmd( keyboard, "3", "EVPathEditorRotateButton.performClick();", "" );
%this.EditorMap.bindCmd( keyboard, "4", "EVPathEditorScaleButton.performClick();", "" );
//----------------------------------------------------------------------
//
// Editor Toggles
//
//----------------------------------------------------------------------
// Add ourselves to the window menu.
%accel = EditorGui.addToEditorsMenu( "Path Editor", "", VPathEditorPlugin );
// Add ourselves to the ToolsToolbar
%tooltip = "Path Editor (" @ %accel @ ")";
EditorGui.addToToolsToolbar( "VPathEditorPlugin", "VPathEditorPalette", expandFilename( "tools/VPathEditor/GUI/Images/btn_Palette" ), %tooltip );
// Find and Store the Button.
%this.ToolbarButton = ToolsToolbarArray.findObjectByInternalName( "VPathEditorPalette", false );
// Extend Width.
%extent = EWToolsToolbar.getExtent();
EWToolsToolbar.setExtent( ( getWord( %extent, 0 ) + 33 ) SPC getWord( %extent, 1 ) );
//----------------------------------------------------------------------
//
// Initialise Toolbar
//
//----------------------------------------------------------------------
if ( !isObject( VPathEditorToolbar ) )
{
exec( "~/VPathEditor/GUI/VPathEditorToolbar.gui" );
}
// Add Toolbar.
EditorGuiToolbar.add( VPathEditorToolbar );
// Populate Type Menu.
VPathEditorToolbarPathTypeMenu.clear();
VPathEditorToolbarPathTypeMenu.add( "BEZIER", 0 );
VPathEditorToolbarPathTypeMenu.add( "LINEAR", 1 );
VPathEditorToolbarPathTypeMenu.setFirstSelected();
//----------------------------------------------------------------------
//
// Initialise Editor Palette
//
//----------------------------------------------------------------------
if ( !isObject( VPathEditorPalette ) )
{
exec( "~/VPathEditor/GUI/VPathEditorPalette.gui" );
}
// Use Existing Group Number + 1.
%groupNum = ToolsPaletteArray.getObject( ToolsPaletteArray.getCount() - 1 ).GroupNum + 1;
%paletteGroup = VPathEditorPalette;
while ( VPathEditorPalette.getCount() > 0 )
{
// Fetch Button.
%paletteButton = %paletteGroup.getObject( 0 );
// Setup.
%paletteButton.Visible = false;
%paletteButton.GroupNum = %groupNum;
%paletteButton.PaletteName = VPathEditorPalette;
// Add To Palette Array.
ToolsPaletteArray.addGuiControl( %paletteButton );
}
//----------------------------------------------------------------------
//
// Initialise Library
//
//----------------------------------------------------------------------
EWCreatorWindow.registerMissionObject( "VPath", "VPath", "", "Level" );
}
//EditorGui.setEditor(\"VPathEditorPlugin\");
function VPathEditorPlugin::onActivated( %this )
{
if ( !isObject( EVPathEditor ) )
{
return;
}
// Display Editor.
EVPathEditor.setVisible( true );
EVPathEditor.makeFirstResponder( true );
EditorGui.bringToFront( EVPathEditor );
VPathEditorToolbar.setVisible( true );
VPathTreeView.open( GetServerPathSet(), true );
// Sync Gizmo.
%this.syncGizmo();
// Enable Map.
%this.EditorMap.push();
// Valid Selection?
if ( EWorldEditor.getSelectionSize() )
{
%selection = EWorldEditor.getSelectedObject( 0 );
if ( isObject( %selection ) && %selection.isMemberOfClass( "VPath" ) )
{
// Select Object.
EVPathEditor.setSelection( %selection );
}
}
// Parent Call.
Parent::onActivated( %this );
}
function VPathEditorPlugin::onDeactivated( %this )
{
// Hide Editor.
EVPathEditor.setVisible( false );
VPathEditorToolbar.setVisible( false );
// Disable Map.
%this.EditorMap.pop();
// Parent Call.
Parent::onDeactivated( %this );
}
function VPathEditorPlugin::isDirty( %this )
{
return EVPathEditor.isDirty;
}
function VPathEditorPlugin::clearDirty( %this )
{
EVPathEditor.isDirty = false;
}
function VPathEditorPlugin::syncGizmo( %this )
{
switch$( GlobalGizmoProfile.Mode )
{
case "None" : EVPathEditorSelectButton.performClick();
case "Move" : EVPathEditorMoveButton.performClick();
case "Rotate" : EVPathEditorRotateButton.performClick();
case "Scale" : EVPathEditorScaleButton.performClick();
}
}

View file

@ -0,0 +1,20 @@
//-----------------------------------------------------------------------------
// Verve
// Copyright (C) - Violent Tulip
//-----------------------------------------------------------------------------
function InitializeVPathEditor()
{
// Gui.
exec( "./GUI/Profiles.cs" );
exec( "./GUI/VPathEditor.gui" );
// Scripts.
exec( "./Scripts/Plugin.cs" );
exec( "./Scripts/Editor.cs" );
}
function DestroyVPathEditor()
{
// Void.
}