Merge pull request #395 from Areloch/MarkActiveScene

WIP of marking active scene in the scenetree
This commit is contained in:
Brian Roberts 2020-12-19 02:35:58 -06:00 committed by GitHub
commit 52ecd8bb0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 5 deletions

View file

@ -540,8 +540,14 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
if( mState.test( ShowObjectName ) )
{
S32 n = 0;
if( hasObjectName )
n = dSprintf( ptr, len, "%s", pObjName );
if (hasObjectName)
{
//If it's been marked, reflect that
if (mState.test(Item::Marked))
n = dSprintf(ptr, len, "*%s", pObjName);
else
n = dSprintf(ptr, len, "%s", pObjName);
}
else if( mState.test( ShowClassNameForUnnamed ) )
n = dSprintf( ptr, len, "%s", pClassName );
@ -549,8 +555,13 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
len -= n;
}
if( hasInternalName && mState.test( ShowInternalName ) )
dSprintf( ptr, len, " [%s]", pInternalName );
if (hasInternalName && mState.test(ShowInternalName))
{
if (mState.test(Item::Marked))
dSprintf(ptr, len, " *[%s]", pInternalName);
else
dSprintf(ptr, len, " [%s]", pObjName);
}
}
}
else

View file

@ -614,6 +614,9 @@ function EditorGui::onNewLevelLoaded( %this, %levelName )
//ECameraSettingsPage.init();
EditorCameraSpeedOptions.setupDefaultState();
//Set our starting Active Scene being edited
EWorldEditor.SetActiveScene(getRootScene());
new ScriptObject( EditorMissionCleanup )
{
parentGroup = "MissionCleanup";
@ -1646,7 +1649,10 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
}
else if( %obj.isMemberOfClass( "Scene" ))
{
%popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
%popup.object = %obj;
%haveObjectEntries = true;
%popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EWorldEditor.SetActiveScene(" @ %popup.object @ ");";
%popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
%popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
%popup.item[ 3 ] = "-";
@ -2280,6 +2286,22 @@ function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect )
}
}
function EWorldEditor::SetActiveScene(%this, %sceneObj)
{
if(isObject($ActiveEditingScene))
{
$ActiveEditingScene.isEditing = false;
%itemId = EditorTree.findItemByObjectId($ActiveScene);
EditorTree.markItem(%itemId);
}
%itemId = EditorTree.findItemByObjectId(%sceneObj);
EditorTree.markItem(%itemId);
$ActiveEditingScene = %sceneObj;
$ActiveEditingScene.isEditing = true;
}
function toggleSnappingOptions( %var )
{
if( SnapToBar->objectSnapDownBtn.getValue() && SnapToBar->objectSnapBtn.getValue() )