Exemplo n.º 1
0
	void Unbind(UJavascriptDelegate* DelegateObject)
	{
		static FName NAME_Fire("Fire");

		if (WeakObject.IsValid())
		{
			if (auto p = Cast<UMulticastDelegateProperty>(Property))
			{
				FScriptDelegate Delegate;
				Delegate.BindUFunction(DelegateObject, NAME_Fire);

				auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
				Target->Remove(Delegate);
			}
			else if (auto p = Cast<UDelegateProperty>(Property))
			{
				auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
				Target->Clear();
			}
		}

		DelegateObject->JavascriptDelegate = nullptr;
		DelegateObject->RemoveFromRoot();
		DelegateObjects.Remove(DelegateObject);

		if (!bAbandoned)
		{
			functions.Remove(DelegateObject->UniqueId);
		}
	}
Exemplo n.º 2
0
	void Bind(UJavascriptDelegate* DelegateObject, Local<Function> function)
	{
		static FName NAME_Fire("Fire");

		if (WeakObject.IsValid())
		{
			if (auto p = Cast<UMulticastDelegateProperty>(Property))
			{
				FScriptDelegate Delegate;
				Delegate.BindUFunction(DelegateObject, NAME_Fire);

				auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
				Target->Add(Delegate);
			}
			else if (auto p = Cast<UDelegateProperty>(Property))
			{
				auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
				Target->BindUFunction(DelegateObject, NAME_Fire);
			}
		}

		DelegateObject->JavascriptDelegate = this;
		DelegateObject->AddToRoot();
		DelegateObjects.Add(DelegateObject);

		functions.Add( DelegateObject->UniqueId, UniquePersistent<Function>(isolate_, function) );
	}
Exemplo n.º 3
0
 virtual FArchive& operator<<(class UObject*& Res) override
 {
     UObject* Object = NULL;
     FObjectReader::operator<<(Object);
     FWeakObjectPtr WeakObjectPtr = Object;
     Res = WeakObjectPtr.Get();
     return *this;
 }
Exemplo n.º 4
0
void FCompilerResultsLog::Append(FCompilerResultsLog const& Other)
{
	for (TSharedRef<FTokenizedMessage> const& Message : Other.Messages)
	{
		switch (Message->GetSeverity())
		{
		case EMessageSeverity::Warning:
			{
				++NumWarnings;
				break;
			}
				
		case EMessageSeverity::Error:
			{
				++NumErrors;
				break;
			}
		}
		Messages.Add(Message);
		
		UEdGraphNode* OwnerNode = nullptr;
		for (TSharedRef<IMessageToken> const& Token : Message->GetMessageTokens())
		{
			if (Token->GetType() != EMessageToken::Object)
			{
				continue;
			}
			
			FWeakObjectPtr ObjectPtr = ((FUObjectToken&)Token.Get()).GetObject();
			if (!ObjectPtr.IsValid())
			{
				continue;
			}
			UObject* ObjectArgument = ObjectPtr.Get();
			
			OwnerNode = Cast<UEdGraphNode>(ObjectArgument);
			if (UEdGraphPin const* Pin = Cast<UEdGraphPin>(ObjectArgument))
			{
				OwnerNode = Pin->GetOwningNodeUnchecked();
			}
		}
		AnnotateNode(OwnerNode, Message);
	}
}
Exemplo n.º 5
0
	void Fire(void* Parms, UJavascriptDelegate* Delegate)
	{
		auto Buffer = reinterpret_cast<uint8*>(Parms);

		auto it = functions.Find(Delegate->UniqueId);
		if (WeakObject.IsValid() && it)
		{
			Isolate::Scope isolate_scope(isolate_);
			HandleScope handle_scope(isolate_);

			auto func = Local<Function>::New(isolate_, *it);
			if (!func.IsEmpty())
			{
				auto context = Local<Context>::New(isolate_, context_);

				Context::Scope context_sopce(context);

				CallJavascriptFunction(context, context->Global(), GetSignatureFunction(), func, Parms);
			}
		}
	}
Exemplo n.º 6
0
AActor* UEnvQueryItemType_Actor::GetValue(const uint8* RawData)
{
	FWeakObjectPtr WeakObjPtr = GetValueFromMemory<FWeakObjectPtr>(RawData);
	return (AActor*)(WeakObjPtr.Get());
}
Exemplo n.º 7
0
	bool IsValid() const
	{
		return WeakObject.IsValid();
	}