コード例 #1
0
void FLiveEditorManager::BroadcastValueUpdate( const FString &ClassName, const FString &PropertyName, const FString &PropertyValue )
{
	// remove closed connections
	for ( TMap<FString, class FSocket *>::TIterator ConnectionIt(RemoteConnections); ConnectionIt; ++ConnectionIt )
	{
		FSocket *Connection = (*ConnectionIt).Value;
		if ( Connection->GetConnectionState() != SCS_Connected )
		{
			RemoteConnections.Remove( (*ConnectionIt).Key );
		}
	}

	//no one to talk to, exit
	if ( RemoteConnections.Num() == 0 )
	{
		return;
	}

	nLiveEditorListenServer::FNetworkMessage Message;
	Message.Type = nLiveEditorListenServer::CLASSDEFAULT_OBJECT_PROPERTY;
	Message.Payload.ClassName = ClassName;
	Message.Payload.PropertyName = PropertyName;
	Message.Payload.PropertyValue = PropertyValue;

	TSharedPtr<FArrayWriter> Datagram = MakeShareable(new FArrayWriter(true));
	*Datagram << Message;

	for ( TMap<FString, class FSocket *>::TIterator ConnectionIt(RemoteConnections); ConnectionIt; ++ConnectionIt )
	{
		FSocket *Connection = (*ConnectionIt).Value;
		int32 BytesSent = 0;
		Connection->Send( Datagram->GetData(), Datagram->Num(), BytesSent );
	}
}
コード例 #2
0
void UK2Node_GetArrayItem::PropagatePinType(FEdGraphPinType& InType)
{
	UClass const* CallingContext = NULL;
	if (UBlueprint const* Blueprint = GetBlueprint())
	{
		CallingContext = Blueprint->GeneratedClass;
		if (CallingContext == NULL)
		{
			CallingContext = Blueprint->ParentClass;
		}
	}

	const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>();
	UEdGraphPin* ArrayPin = Pins[0];
	UEdGraphPin* ResultPin = Pins[2];

	ArrayPin->PinType = InType;
	ArrayPin->PinType.bIsArray = true;
	ArrayPin->PinType.bIsReference = false;

	ResultPin->PinType = InType;
	ResultPin->PinType.bIsArray = false;
	ResultPin->PinType.bIsReference = !(ResultPin->PinType.PinCategory == Schema->PC_Object || ResultPin->PinType.PinCategory == Schema->PC_Class || ResultPin->PinType.PinCategory == Schema->PC_Asset || ResultPin->PinType.PinCategory == Schema->PC_AssetClass || ResultPin->PinType.PinCategory == Schema->PC_Interface);
	ResultPin->PinType.bIsConst = false;


	// Verify that all previous connections to this pin are still valid with the new type
	for (TArray<UEdGraphPin*>::TIterator ConnectionIt(ArrayPin->LinkedTo); ConnectionIt; ++ConnectionIt)
	{
		UEdGraphPin* ConnectedPin = *ConnectionIt;
		if (!Schema->ArePinsCompatible(ArrayPin, ConnectedPin, CallingContext))
		{
			ArrayPin->BreakLinkTo(ConnectedPin);
		}
	}

	// Verify that all previous connections to this pin are still valid with the new type
	for (TArray<UEdGraphPin*>::TIterator ConnectionIt(ResultPin->LinkedTo); ConnectionIt; ++ConnectionIt)
	{
		UEdGraphPin* ConnectedPin = *ConnectionIt;
		if (!Schema->ArePinsCompatible(ResultPin, ConnectedPin, CallingContext))
		{
			ResultPin->BreakLinkTo(ConnectedPin);
		}
	}
}
コード例 #3
0
void UK2Node_MakeArray::PropagatePinType()
{
	const UEdGraphPin* OutputPin = GetOutputPin();

	if (OutputPin)
	{
		UClass const* CallingContext = NULL;
		if (UBlueprint const* Blueprint = GetBlueprint())
		{
			CallingContext = Blueprint->GeneratedClass;
			if (CallingContext == NULL)
			{
				CallingContext = Blueprint->ParentClass;
			}
		}

		const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>();
		bool bWantRefresh = false;
		// Propagate pin type info (except for array info!) to pins with dependent types
		for (TArray<UEdGraphPin*>::TIterator it(Pins); it; ++it)
		{
			UEdGraphPin* CurrentPin = *it;

			if (CurrentPin != OutputPin)
			{
				bWantRefresh = true;
				CurrentPin->PinType.PinCategory = OutputPin->PinType.PinCategory;
				CurrentPin->PinType.PinSubCategory = OutputPin->PinType.PinSubCategory;
				CurrentPin->PinType.PinSubCategoryObject = OutputPin->PinType.PinSubCategoryObject;

				// Verify that all previous connections to this pin are still valid with the new type
				for (TArray<UEdGraphPin*>::TIterator ConnectionIt(CurrentPin->LinkedTo); ConnectionIt; ++ConnectionIt)
				{
					UEdGraphPin* ConnectedPin = *ConnectionIt;
					if (!Schema->ArePinsCompatible(CurrentPin, ConnectedPin, CallingContext))
					{
						CurrentPin->BreakLinkTo(ConnectedPin);
					}
				}
			}
		}
		// If we have a valid graph we should refresh it now to refelect any changes we made
		if( (bWantRefresh == true ) && ( OutputPin->GetOwningNode() != NULL ) && ( OutputPin->GetOwningNode()->GetGraph() != NULL ) )
		{
			OutputPin->GetOwningNode()->GetGraph()->NotifyGraphChanged();
		}
	}
}