Exemplo n.º 1
0
void SDetailsView::RemoveInvalidObjects()
{
	TArray< TWeakObjectPtr< UObject > > ResetArray;

	bool bAllFound = true;
	
	for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootPropertyNodes)
	{
		FObjectPropertyNode* RootPropertyNode = ComplexRootNode->AsObjectNode();
		if(RootPropertyNode)
		{
			for(TPropObjectIterator Itor(RootPropertyNode->ObjectIterator()); Itor; ++Itor)
			{
				TWeakObjectPtr<UObject> Object = *Itor;

				if(Object.IsValid() && !Object->IsPendingKill())
				{
					ResetArray.Add(Object);
				}
				else
				{
					bAllFound = false;
				}
			}
		}
	}

	if (!bAllFound)
	{
		SetObjectArrayPrivate(ResetArray);
	}
}
Exemplo n.º 2
0
void SoundEmitter::update(EventDetails* const details)
{
    OSG_ASSERT(getParents().size() == 1 && "A Sound Emitter NodeCore MUST have 1 and only 1 parent.");

    Matrix wm;
    dynamic_cast<Node*>(_mfParents[0])->getToWorld(wm);
    Pnt3f Position(0, 0, 0);
    wm.mult(Pnt3f(0.0f,0.0f,0.0f),Position);

    if(getSound() != NULL)
    {
        //Remove all invalid
        for(std::set<UInt32>::iterator Itor(_EmittedSoundChannels.begin()) ; Itor != _EmittedSoundChannels.end() ;)
        {
            if(!getSound()->isValid(*Itor))
            {
                std::set<UInt32>::iterator EraseItor(Itor);
                ++Itor;
                _EmittedSoundChannels.erase(EraseItor);
            }
            else
            {

                //getSound()->setChannelVelocity(_PreviousPosition - Position * (1.0f/dynamic_cast<UpdateEventDetails* const>(details)->getElapsedTime()), *Itor);
                

                getSound()->setChannelPosition(Position, *Itor);
                ++Itor;
            }
        }
    }

    _PreviousPosition = Position;
}
void CompoundUndoableEdit::undo(void)
{
	for(EditVector::reverse_iterator Itor(_Edits.rbegin()) ; Itor != _Edits.rend() ; ++Itor)
	{
		(*Itor)->undo();
	}
}
Exemplo n.º 4
0
void SDetailsView::RemoveDeletedObjects( const TArray<UObject*>& DeletedObjects )
{
	TArray< TWeakObjectPtr< UObject > > NewObjectList;
	bool bObjectsRemoved = false;

	for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootPropertyNodes)
	{
		FObjectPropertyNode* RootPropertyNode = ComplexRootNode->AsObjectNode();
		// Scan all objects and look for objects which need to be replaced
		for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			if( DeletedObjects.Contains( Itor->Get() ) )
			{
				// An object we had needs to be removed
				bObjectsRemoved = true;
			}
			else
			{
				// If the deleted object list does not contain the current object, its ok to keep it in the list
				NewObjectList.Add( Itor->Get() );
			}
		}
	}

	// if any objects were replaced update the observed objects
	if( bObjectsRemoved )
	{
		SetObjectArrayPrivate( NewObjectList );
	}
}
TSharedRef<SWidget> SPropertyEditorEditInline::GenerateClassPicker()
{
	FClassViewerInitializationOptions Options;
	Options.bShowUnloadedBlueprints = true;
	Options.bShowDisplayNames = true;
	Options.bShowNoneOption = true;

	TSharedPtr<FPropertyEditorInlineClassFilter> ClassFilter = MakeShareable( new FPropertyEditorInlineClassFilter );
	Options.ClassFilter = ClassFilter;
	ClassFilter->bAllowAbstract = false;

	const TSharedRef< FPropertyNode > PropertyNode = PropertyEditor->GetPropertyNode();
	UProperty* Property = PropertyNode->GetProperty();
	ClassFilter->ObjProperty = Cast<UObjectPropertyBase>( Property );
	ClassFilter->IntProperty = Cast<UInterfaceProperty>( Property );

	FObjectPropertyNode* ObjectPropertyNode = PropertyNode->FindObjectItemParent();
	if( ObjectPropertyNode )
	{
		for ( TPropObjectIterator Itor( ObjectPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			UObject* OwnerObject = Itor->Get();
			ClassFilter->LimitToIsAOfAllObjects.Add( OwnerObject );
		}
	}

	Options.PropertyHandle = PropertyEditor->GetPropertyHandle();

	FOnClassPicked OnPicked( FOnClassPicked::CreateRaw( this, &SPropertyEditorEditInline::OnClassPicked ) );

	return FModuleManager::LoadModuleChecked<FClassViewerModule>("ClassViewer").CreateClassViewer(Options, OnPicked);
}
Exemplo n.º 6
0
OSG_BEGIN_NAMESPACE

const FieldContainerType* getClosestAncestor(const FieldContainerType *type,
                                             MFUnrecFieldContainerPtr::const_iterator begin,
                                             MFUnrecFieldContainerPtr::const_iterator end)
{
    if(type == NULL)
    {
        return NULL;
    }

    const FieldContainerType* AncestorType(NULL);
    const FieldContainerType* FCType(NULL);
    MFUnrecFieldContainerPtr::const_iterator Itor(begin);
    for(; Itor!=end ; ++Itor)
    {
        FCType = &((*Itor)->getType());
        if(type->isDerivedFrom(*FCType)&&
           (AncestorType == NULL || FCType->isDerivedFrom(*AncestorType)))
        {
            AncestorType = FCType;
        }
    }

    return AncestorType;
}
Exemplo n.º 7
0
bool FEdModeGeometry::ExecDelete()
{
	check( GEditorModeTools().IsModeActive( FBuiltinEditorModes::EM_Geometry ) );

	FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Geometry );

	// Find the delete modifier and execute it.

	FModeTool_GeometryModify* mtgm = (FModeTool_GeometryModify*)FindTool( MT_GeometryModify );

	for( FModeTool_GeometryModify::TModifierIterator Itor( mtgm->ModifierIterator() ) ; Itor ; ++Itor )
	{
		UGeomModifier* gm = *Itor;

		if( gm->IsA( UGeomModifier_Delete::StaticClass()) )
		{
			if( gm->Apply() )
			{
				return 1;
			}
		}
	}

	return 0;
}
Exemplo n.º 8
0
void SSingleProperty::ReplaceObjects( const TMap<UObject*, UObject*>& OldToNewObjectMap )
{
	if( HasValidProperty() )
	{
		TArray<UObject*> NewObjectList;
		bool bObjectsReplaced = false;

		// Scan all objects and look for objects which need to be replaced
		for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			UObject* Replacement = OldToNewObjectMap.FindRef( Itor->Get() );
			if( Replacement )
			{
				bObjectsReplaced = true;
				NewObjectList.Add( Replacement );
			}
			else
			{
				NewObjectList.Add( Itor->Get() );
			}
		}

		// if any objects were replaced update the observed objects
		if( bObjectsReplaced )
		{
			SetObject( NewObjectList[0] );
		}
	}
}
Exemplo n.º 9
0
/** @return		true if something was selected/deselected, false otherwise. */
bool FModeTool_GeometryModify::FrustumSelect( const FConvexVolume& InFrustum, bool InSelect /* = true */ )
{
	bool bResult = false;
	if( GEditorModeTools().IsModeActive( FBuiltinEditorModes::EM_Geometry ) )
	{
		FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Geometry );

		for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
		{
			FGeomObject* go = *Itor;
			FTransform ActorToWorld = go->GetActualBrush()->ActorToWorld();
			// Check each vertex to see if its inside the frustum
			for( int32 v = 0 ; v < go->VertexPool.Num() ; ++v )
			{
				FGeomVertex& gv = go->VertexPool[v];
				if( InFrustum.IntersectBox( ActorToWorld.TransformPosition( gv.GetMid() ), FVector::ZeroVector ) )
				{
					gv.Select( InSelect );
					bResult = true;
				}
			}
		}
	}
	return bResult;
}
Exemplo n.º 10
0
/** @return		true if something was selected/deselected, false otherwise. */
bool FModeTool_GeometryModify::BoxSelect( FBox& InBox, bool InSelect )
{
	bool bResult = false;
	if( GEditorModeTools().IsModeActive( FBuiltinEditorModes::EM_Geometry ) )
	{
		FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Geometry );

		for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
		{
			FGeomObject* go = *Itor;
			FTransform ActorToWorld = go->GetActualBrush()->ActorToWorld();

			// Only verts for box selection

			for( int32 v = 0 ; v < go->VertexPool.Num() ; ++v )
			{
				FGeomVertex& gv = go->VertexPool[v];
				if( FMath::PointBoxIntersection( ActorToWorld.TransformPosition( gv.GetMid() ), InBox ) )
				{
					gv.Select( InSelect );
					bResult = true;
				}
			}
		}
	}
	return bResult;
}
bool CompoundUndoableEdit::isSignificant(void) const
{
	for(EditVector::const_iterator Itor(_Edits.begin()) ; Itor != _Edits.end() ; ++Itor)
	{
		if((*Itor)->isSignificant())
		{
			return true;
		}
	}
	return false;
}
Exemplo n.º 12
0
void FEdModeGeometry::AddReferencedObjects( FReferenceCollector& Collector )
{
	// Call parent implementation
	FEdMode::AddReferencedObjects( Collector );

	FModeTool_GeometryModify* mtgm = (FModeTool_GeometryModify*)FindTool( MT_GeometryModify );
	for( FModeTool_GeometryModify::TModifierIterator Itor( mtgm->ModifierIterator() ) ; Itor ; ++Itor )
	{
		Collector.AddReferencedObject( *Itor );
	}
}
Exemplo n.º 13
0
std::vector< ::osg::UInt32 > SceneEditor::getEditorTypeIds(void) const
{
	std::vector< ::osg::UInt32 > Result;

	for(FieldContainerFactory::TypeMapIterator Itor(FieldContainerFactory::the()->beginTypes()) ; Itor != FieldContainerFactory::the()->endTypes() ; ++Itor)
	{
		if(Itor->second->isDerivedFrom(SceneComponentEditor::getClassType()))
		{
			Result.push_back(Itor->second->getId());
		}
	}

	return Result;
}
Exemplo n.º 14
0
void SDetailsView::ForceRefresh()
{
	TArray< TWeakObjectPtr< UObject > > NewObjectList;

	// Simply re-add the same existing objects to cause a refresh
	for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
	{
		TWeakObjectPtr<UObject> Object = *Itor;
		if( Object.IsValid() )
		{
			NewObjectList.Add( Object.Get() );
		}
	}

	SetObjectArrayPrivate( NewObjectList );
}
Exemplo n.º 15
0
void SSingleProperty::RemoveDeletedObjects( const TArray<UObject*>& DeletedObjects )
{

	if( HasValidProperty() )
	{
		// Scan all objects and look for objects which need to be replaced
		for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			if( DeletedObjects.Contains( Itor->Get() ) )
			{
				SetObject( NULL );
				break;
			}
		}
	}
}
Exemplo n.º 16
0
DialogWindowTransitPtr loadCreditsWindow(const BoostPath& WindowDefinitionFile)
{
    FCFileType::FCPtrStore NewContainers;
    NewContainers = FCFileHandler::the()->read(WindowDefinitionFile);

    for(FCFileType::FCPtrStore::iterator Itor(NewContainers.begin()) ; Itor!= NewContainers.end() ; ++Itor)
    {
        if((*Itor)->getType() == DialogWindow::getClassType())
        {
            return DialogWindowTransitPtr(dynamic_pointer_cast<DialogWindow>(*Itor));
        }
    }
    SFATAL << "Failed to load Builder Credits Window definition from file: " << WindowDefinitionFile.string() << std::endl;

    return DialogWindowTransitPtr(NULL);
}
Exemplo n.º 17
0
bool FModeTool_GeometryModify::EndModify()
{
	// Let the modifier finish up.
	if( CurrentModifier != NULL )
	{
		FEdModeGeometry* mode = ((FEdModeGeometry*)GEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Geometry));

		// Update the source data to match the current geometry data.
		mode->SendToSource();

		// Make sure the source data has remained viable.
		if( mode->FinalizeSourceData() )
		{
			// If the source data was modified, reconstruct the geometry data to reflect that.
			mode->GetFromSource();
		}

		CurrentModifier->EndModify();

		// Update internals.
		for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
		{
			FGeomObject* go = *Itor;
			go->ComputeData();
			FBSPOps::bspUnlinkPolys( go->GetActualBrush()->Brush );			
			
			// If geometry was actually changed, call PostEditBrush
			if(bGeomModified)
			{
				ABrush* Brush = go->GetActualBrush();
				if(Brush)
				{
					if(!Brush->IsStaticBrush())
					{
						FBSPOps::csgPrepMovingBrush(Brush);
					}
				}
				bGeomModified = false;
			}
		}		
	}

	return 1;
}
Exemplo n.º 18
0
void SDetailsView::ReplaceObjects( const TMap<UObject*, UObject*>& OldToNewObjectMap )
{
	TArray< TWeakObjectPtr< UObject > > NewObjectList;
	bool bObjectsReplaced = false;

	TArray< FObjectPropertyNode* > ObjectNodes;
	for(TSharedPtr<FComplexPropertyNode>& RootNode : RootPropertyNodes)
	{
		PropertyEditorHelpers::CollectObjectNodes(RootNode, ObjectNodes );
	}

	for( int32 ObjectNodeIndex = 0; ObjectNodeIndex < ObjectNodes.Num(); ++ObjectNodeIndex )
	{
		FObjectPropertyNode* CurrentNode = ObjectNodes[ObjectNodeIndex];

		// Scan all objects and look for objects which need to be replaced
		for ( TPropObjectIterator Itor( CurrentNode->ObjectIterator() ); Itor; ++Itor )
		{
			UObject* Replacement = OldToNewObjectMap.FindRef( Itor->Get() );
			if( Replacement && Replacement->GetClass() == Itor->Get()->GetClass() )
			{
				bObjectsReplaced = true;
				if( CurrentNode->IsRootNode() )
				{
					// Note: only root objects count for the new object list. Sub-Objects (i.e components count as needing to be replaced but they don't belong in the top level object list
					NewObjectList.Add( Replacement );
				}
			}
			else if( CurrentNode->IsRootNode() )
			{
				// Note: only root objects count for the new object list. Sub-Objects (i.e components count as needing to be replaced but they don't belong in the top level object list
				NewObjectList.Add( Itor->Get() );
			}
		}
	}


	if( bObjectsReplaced )
	{
		SetObjectArrayPrivate( NewObjectList );
	}

}
void SPropertyEditorEditInline::OnClassPicked(UClass* InClass)
{
	TArray<FObjectBaseAddress> ObjectsToModify;
	TArray<FString> NewValues;

	const TSharedRef< FPropertyNode > PropertyNode = PropertyEditor->GetPropertyNode();
	FObjectPropertyNode* ObjectNode = PropertyNode->FindObjectItemParent();

	if( ObjectNode )
	{
		for ( TPropObjectIterator Itor( ObjectNode->ObjectIterator() ) ; Itor ; ++Itor )
		{
			FString NewValue;
			if (InClass)
			{
				UObject*		Object = Itor->Get();
				UObject*		UseOuter = (InClass->IsChildOf(UClass::StaticClass()) ? Cast<UClass>(Object)->GetDefaultObject() : Object);
				EObjectFlags	MaskedOuterFlags = UseOuter ? UseOuter->GetMaskedFlags(RF_PropagateToSubObjects) : RF_NoFlags;
				if (UseOuter && UseOuter->HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
				{
					MaskedOuterFlags |= RF_ArchetypeObject;
				}
				UObject*		NewObject = StaticConstructObject(InClass, UseOuter, NAME_None, MaskedOuterFlags, NULL);

				NewValue = NewObject->GetPathName();
			}
			else
			{
				NewValue = FName(NAME_None).ToString();
			}
			NewValues.Add(NewValue);
		}

		const TSharedRef< IPropertyHandle > PropertyHandle = PropertyEditor->GetPropertyHandle();
		PropertyHandle->SetPerObjectValues( NewValues );

		// Force a rebuild of the children when this node changes
		PropertyNode->RequestRebuildChildren();

		ComboButton->SetIsOpen(false);
	}
}
Exemplo n.º 20
0
int32 FGeomObject::GetObjectIndex()
{
	if( !GEditorModeTools().IsModeActive(FBuiltinEditorModes::EM_Geometry) )
	{
		return INDEX_NONE;
	}

	FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Geometry);

	for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
	{
		if( *Itor == this )
		{
			return Itor.GetIndex();
		}
	}

	check(0);	// Should never happen
	return INDEX_NONE;
}
Exemplo n.º 21
0
bool SDetailsView::ShouldSetNewObjects( const TArray< TWeakObjectPtr< UObject > >& InObjects ) const
{
	bool bShouldSetObjects = false;

	const bool bHadBSPBrushSelected = SelectedActorInfo.bHaveBSPBrush;
	if( bHadBSPBrushSelected == true )
	{
		// If a BSP brush was selected we need to refresh because surface could have been selected and the object set not updated
		bShouldSetObjects = true;
	}
	else if( InObjects.Num() != RootPropertyNode->GetNumObjects() )
	{
		// If the object arrys differ in size then at least one object is different so we must reset
		bShouldSetObjects = true;
	}
	else
	{
		// Check to see if the objects passed in are different. If not we do not need to set anything
		TSet< TWeakObjectPtr< UObject > > NewObjects;
		NewObjects.Append( InObjects );
		for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			TWeakObjectPtr<UObject> Object = *Itor;
			if( Object.IsValid() && !NewObjects.Contains( Object ) )
			{
				// An existing object is not in the list of new objects to set
				bShouldSetObjects = true;
				break;
			}
			else if( !Object.IsValid() )
			{
				// An existing object is invalid
				bShouldSetObjects = true;
				break;
			}
		}
	}

	return bShouldSetObjects;
}
void DefaultTableColumnModel::removeColumn(TableColumn* const column)
{
    //Find the Column
    UInt32 FindIndex(0);
    MFInternalColumnsType::iterator Itor(editMFInternalColumns()->begin());
    while(FindIndex < getMFInternalColumns()->size() && column !=
          getInternalColumns(FindIndex))
    {
        ++FindIndex;
        ++Itor;
    }

    if(FindIndex != getMFInternalColumns()->size())
    {
        //Erase
        editMFInternalColumns()->erase(Itor);
        recalcWidthCache();
        //column->removeFieldChangeListener(&_TableFieldChangeListener);
        produceColumnRemoved(FindIndex);
    }

}
Exemplo n.º 23
0
void SDetailsView::ForceRefresh()
{
	TArray< TWeakObjectPtr< UObject > > NewObjectList;

	const FRootPropertyNodeList& RootNodes = GetRootNodes();
	for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootNodes)
	{
		FObjectPropertyNode* RootNode = ComplexRootNode->AsObjectNode();
		if(RootNode)
		{
			// Simply re-add the same existing objects to cause a refresh
			for(TPropObjectIterator Itor(RootNode->ObjectIterator()); Itor; ++Itor)
			{
				TWeakObjectPtr<UObject> Object = *Itor;
				if(Object.IsValid())
				{
					NewObjectList.Add(Object.Get());
				}
			}
		}
	}

	SetObjectArrayPrivate( NewObjectList );
}
Exemplo n.º 24
0
void SDetailsView::RemoveInvalidObjects()
{
	TArray< TWeakObjectPtr< UObject > > ResetArray;

	bool bAllFound = true;
	for (TPropObjectIterator Itor(RootPropertyNode->ObjectIterator()); Itor; ++Itor)
	{
		TWeakObjectPtr<UObject> Object = *Itor;

		if( Object.IsValid() && !Object->IsPendingKill() )
		{
			ResetArray.Add(Object);
		}
		else
		{
			bAllFound = false;
		}
	}

	if (!bAllFound)
	{
		SetObjectArrayPrivate(ResetArray);
	}
}
Exemplo n.º 25
0
/**
 * @return		true if the key was handled by this editor mode tool.
 */
bool FModeTool_GeometryModify::InputKey(FLevelEditorViewportClient* ViewportClient, FViewport* Viewport, FKey Key, EInputEvent Event)
{
	check( GEditorModeTools().IsModeActive( FBuiltinEditorModes::EM_Geometry ) );
	// Give the current modifier a chance to handle this first
	if( CurrentModifier && CurrentModifier->InputKey( ViewportClient, Viewport, Key, Event ) )
	{
		return true;
	}

	if (Key == EKeys::Escape)
	{
		// Hitting ESC will deselect any subobjects first.  If no subobjects are selected, then it will
		// deselect the brushes themselves.

		FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Geometry );
		bool bHadSubObjectSelections = (mode->GetSelectionState() > 0) ? true : false;

		for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
		{
			FGeomObject* go = *Itor;

			for( int32 p = 0 ; p < go->PolyPool.Num() ; ++p )
			{
				FGeomPoly& gp = go->PolyPool[p];
				if( gp.IsSelected() )
				{
					gp.Select( false );
					bHadSubObjectSelections = true;
				}
			}

			for( int32 e = 0 ; e < go->EdgePool.Num() ; ++e )
			{
				FGeomEdge& ge = go->EdgePool[e];
				if( ge.IsSelected() )
				{
					ge.Select( false );
					bHadSubObjectSelections = true;
				}
			}

			for( int32 v = 0 ; v < go->VertexPool.Num() ; ++v )
			{
				FGeomVertex& gv = go->VertexPool[v];
				if( gv.IsSelected() )
				{
					gv.Select( false );
					bHadSubObjectSelections = true;
				}
			}
		}

		if( bHadSubObjectSelections )
		{
			GEditor->RedrawAllViewports();
			return true;
		}
	}
	else
	{
		return FModeTool::InputKey( ViewportClient, Viewport, Key, Event );
	}

	return false;
}
Exemplo n.º 26
0
 Itor begin() { return Itor(v, 0); }
Exemplo n.º 27
0
 Itor end() { return Itor(v, v.size()); }
Exemplo n.º 28
0
void keyPressed( KeyEventDetails* const e)
{
    WindowEventProducer* TheWindow(dynamic_cast<WindowEventProducer*>(e->getSource()));
    std::cout << "Key: " << e->getKey() << " with char value: " << e->getKeyChar()<< " Pressed. Modifiers: " << e->getModifiers() << std::endl;
    if(e->getModifiers() & KeyEventDetails::KEY_MODIFIER_COMMAND)
    {
        switch(e->getKey())
        {
            case KeyEventDetails::KEY_L:
                TheWindow->setShowCursor(false);
                TheWindow->setAttachMouseToCursor(false);
                break;
            case KeyEventDetails::KEY_U:
                TheWindow->setShowCursor(true);
                TheWindow->setAttachMouseToCursor(true);
                break;
            case KeyEventDetails::KEY_O:
                {
                    std::vector<WindowEventProducer::FileDialogFilter> Filters;
                    Filters.push_back(WindowEventProducer::FileDialogFilter("Some File Type","cpp"));
                    Filters.push_back(WindowEventProducer::FileDialogFilter("All","*"));

                    std::vector<BoostPath> FilesToOpen;
                    FilesToOpen = dynamic_cast<WindowEventProducer*>(e->getSource())->openFileDialog("Open A File, Yo?",
                                                                                                     Filters,
                                                                                                     BoostPath(".."),
                                                                                                     true);

                    std::cout << "Files to Open: "<< std::endl;
                    for(std::vector<BoostPath>::iterator Itor(FilesToOpen.begin()) ; Itor != FilesToOpen.end(); ++Itor)
                    {
                        std::cout << Itor->string() << std::endl;
                    }
                }
                break;
            case KeyEventDetails::KEY_S:
                {
                    std::vector<WindowEventProducer::FileDialogFilter> Filters;
                    Filters.push_back(WindowEventProducer::FileDialogFilter("Some File Type","cpp"));
                    Filters.push_back(WindowEventProducer::FileDialogFilter("All","*"));

                    BoostPath SavePath= dynamic_cast<WindowEventProducer*>(e->getSource())->saveFileDialog("Save A File, Yo?",
                                                                                                           Filters,
                                                                                                           std::string("NewCodeFile.cpp"),
                                                                                                           BoostPath(".."),
                                                                                                           true);

                    std::cout << "File to Save: " << SavePath.string() << std::endl;
                }
                break;
            case KeyEventDetails::KEY_Q:
                TheWindow->closeWindow();
                break;
        }
    }
    else
    {
    switch(e->getKey()){
        case KeyEventDetails::KEY_P:
            //Center
            TheWindow->setPosition((TheWindow->getDesktopSize() - TheWindow->getSize()) *0.3);
            break;
        case KeyEventDetails::KEY_R:
            TheWindow->setSize(Vec2us(TheWindow->getDesktopSize() * 0.65f));
            break;
        case KeyEventDetails::KEY_F:
            TheWindow->setFullscreen(!TheWindow->getFullscreen());
            break;
        case KeyEventDetails::KEY_G:
            TheWindow->setFullscreen(false);
            break;
        case KeyEventDetails::KEY_S:
            TheWindow->setVisible(true);
            break;
        case KeyEventDetails::KEY_H:
            TheWindow->setVisible(false);
            break;
        case KeyEventDetails::KEY_I:
            TheWindow->setIconify(true);
            break;
        case KeyEventDetails::KEY_D:
            TheWindow->setIconify(false);
            break;
             
        case KeyEventDetails::KEY_K:
            TheWindow->setFocused(true);
            break;
        case KeyEventDetails::KEY_J:
            TheWindow->setFocused(false);
            break;
        case KeyEventDetails::KEY_C:
            TheWindow->setShowCursor(!TheWindow->getShowCursor());
            break;
        case KeyEventDetails::KEY_1:
            TheWindow->putClipboard(std::string("From OpenSGToolbox"));
            break;
        case KeyEventDetails::KEY_2:
            std::cout << TheWindow->getClipboard() << std::endl;
            break;
        case KeyEventDetails::KEY_M:
            std::cout << TheWindow->getMousePosition() << std::endl;
            break;
        default:
            break;
    }
    }
}
Exemplo n.º 29
0
bool SDetailsView::ShouldSetNewObjects(const TArray< TWeakObjectPtr< UObject > >& InObjects) const
{
	bool bShouldSetObjects = false;

	const bool bHadBSPBrushSelected = SelectedActorInfo.bHaveBSPBrush;
	if( bHadBSPBrushSelected == true )
	{
		// If a BSP brush was selected we need to refresh because surface could have been selected and the object set not updated
		bShouldSetObjects = true;
	}
	else if( InObjects.Num() != GetNumObjects() )
	{
		// If the object arrays differ in size then at least one object is different so we must reset
		bShouldSetObjects = true;
	}
	else if(InObjects.Num() == 0)
	{
		// User is likely resetting details panel
		bShouldSetObjects = true;
	}
	else
	{
		// Check to see if the objects passed in are different. If not we do not need to set anything
		TSet< TWeakObjectPtr< UObject > > NewObjects;
		NewObjects.Append(InObjects);

		if(DetailsViewArgs.bAllowMultipleTopLevelObjects)
		{
			
			// For multiple top level node support, if the single object in each node is not found in the new object set
			// then we need to refresh
			for(int32 RootNodeIndex = 0; RootNodeIndex < RootPropertyNodes.Num(); ++RootNodeIndex)
			{
				FObjectPropertyNode* RootPropertyNode = RootPropertyNodes[RootNodeIndex]->AsObjectNode();
				
				if(RootPropertyNode && RootPropertyNode->GetNumObjects() > 0)
				{
					if(!NewObjects.Contains(RootPropertyNode->GetUObject(0)))
					{
						bShouldSetObjects = true;
						break;
					}
				}
				else
				{
					bShouldSetObjects = true;
					break;
				}
			}
		}
		else
		{

			ensure(RootPropertyNodes.Num() == 1);
			FObjectPropertyNode* RootPropertyNode = RootPropertyNodes[0]->AsObjectNode();
			if( RootPropertyNode )
			{
				for(TPropObjectIterator Itor(RootPropertyNode->ObjectIterator()); Itor; ++Itor)
				{
					TWeakObjectPtr<UObject> Object = *Itor;
					if(Object.IsValid() && !NewObjects.Contains(Object))
					{
						// An existing object is not in the list of new objects to set
						bShouldSetObjects = true;
						break;
					}
					else if(!Object.IsValid())
					{
						// An existing object is invalid
						bShouldSetObjects = true;
						break;
					}
				}
			}
			else
			{
				bShouldSetObjects = true;
			}
		}
	}
	
	if (!bShouldSetObjects && AssetSelectionUtils::IsAnySurfaceSelected(nullptr))
	{
		bShouldSetObjects = true;
	}

	return bShouldSetObjects;
}
void SkeletonBlendedGeometry::changed(ConstFieldMaskArg whichField, 
                                      UInt32            origin,
                                      BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if((whichField & BaseGeometryFieldMask) &&
            getBaseGeometry() != NULL)
    {
        if(getBaseGeometry()->getTypes() != NULL)
        {
            setTypes(getBaseGeometry()->getTypes());
        }
        if(getBaseGeometry()->getLengths() != NULL)
        {
            setLengths(getBaseGeometry()->getLengths());
        }
        if(getBaseGeometry()->getPositions() != NULL)
        {
            GeoPropertyUnrecPtr Pos(getBaseGeometry()->getPositions()->clone());
            setPositions(dynamic_pointer_cast<GeoVectorProperty>(Pos));
        }
        if(getBaseGeometry()->getNormals() != NULL)
        {
            GeoPropertyUnrecPtr Norm(getBaseGeometry()->getNormals()->clone());
            setNormals(dynamic_pointer_cast<GeoVectorProperty>(Norm));
        }
        if(getBaseGeometry()->getColors() != NULL)
        {
            setColors(getBaseGeometry()->getColors());
        }
        if(getBaseGeometry()->getSecondaryColors() != NULL)
        {
            setSecondaryColors(getBaseGeometry()->getSecondaryColors());
        }
        if(getBaseGeometry()->getTexCoords() != NULL)
        {
            setTexCoords(getBaseGeometry()->getTexCoords());
        }
        if(getBaseGeometry()->getTexCoords1() != NULL)
        {
            setTexCoords1(getBaseGeometry()->getTexCoords1());
        }
        if(getBaseGeometry()->getTexCoords2() != NULL)
        {
            setTexCoords2(getBaseGeometry()->getTexCoords2());
        }
        if(getBaseGeometry()->getTexCoords3() != NULL)
        {
            setTexCoords3(getBaseGeometry()->getTexCoords3());
        }
        if(getBaseGeometry()->getTexCoords4() != NULL)
        {
            setTexCoords4(getBaseGeometry()->getTexCoords4());
        }
        if(getBaseGeometry()->getTexCoords5() != NULL)
        {
            setTexCoords5(getBaseGeometry()->getTexCoords5());
        }
        if(getBaseGeometry()->getTexCoords6() != NULL)
        {
            setTexCoords6(getBaseGeometry()->getTexCoords6());
        }
        if(getBaseGeometry()->getTexCoords7() != NULL)
        {
            setTexCoords7(getBaseGeometry()->getTexCoords7());
        }
        if(getBaseGeometry()->getIndices() != NULL)
        {
            setIndices(getBaseGeometry()->getIndices());
        }
        setMaterial(getBaseGeometry()->getMaterial());
    }

    if((whichField & JointsFieldMask) ||
        (whichField & PositionIndexesFieldMask) ||
        (whichField & BlendAmountsFieldMask))
    {
        calculatePositions();
    }

    if(whichField & SkeletonsFieldMask)
    {
        for(std::vector<EventConnection>::iterator Itor(_SkeletonListenerConnections.begin()) ; Itor != _SkeletonListenerConnections.end() ; ++Itor)
        {
            Itor->disconnect();
        }

        _SkeletonListenerConnections.clear();

        for(UInt32 i(0) ; i<getMFSkeletons()->size() ; ++i)
        {
            _SkeletonListenerConnections.push_back(getSkeletons(i)->addSkeletonListener(this));
        }
    }
}