how to get callback of datasmith runtime? - unreal-engine4

I'm using unreal blueprint of datasmith to load revit model in runtime. but i don't know out how to emit callback when the model has been load and rendered.
the "Datasmith Destination Actor" has a property of progress, i try to watch that property but no luck.
First, the end value is not 1 but 1.396324 ,
Secondly, event when progress reached 1.396324 the hierarchy has not been rendered completely.
watch on datasmith runtime actor

Related

Can't pick StaticMeshActor from scene when I create variable of that type in blueprint, if the actor is from sub-level in Unreal Engine 5

I have made an blueprint and inside of it, variable of type StaticMeshActor (object reference):
When I create instance of this blueprint in scene, I get the drop-down for my “Test” variable with StaticMeshActor actors in scene (that’s correct).
But once I click on any of them (that are from sub-levels), field resets to “None” again. Same goes for picker icon from scene.
Is it bug, or am I doing something wrong? Is it even possible to select actor from sub-level?

UE4 Display Actor Components at Runtime in PIE

I create and attach some actor components at runtime and destroy them later when playing.
I would like to see during runtime in PIE what components an actor has.
I already tried to display the components by checking the Show Actor Components in the View options of the Details panel, but it seems to only display scene components, and to not refresh the view correctly (I have to check then uncheck Selected Actor Only for the spawned actor to display all their scene components).
Is there a way to do display them?
can you tell me you are using C++ or Blueprints ?
If you are using C++, you can create a method to show the existing Components in your Actor. You can use the method GetComponents to get all Components of the class UActorComponent because all the Unreal Engine's components inherit from this Class. And then you can check their classes and print the name and the class for example.
This is an example of code :
void AMyActor::ShowMyComponents() {
TArray<UActorComponent*> MyArray;
GetComponents(UActorComponent::StaticClass(), MyArray, true);
for (auto element : MyArray) {
UE_LOG(LogTemp, Error, TEXT("Component : %s is from class : %s"), *element->GetName(), *element->GetClass()->GetName());
}
}
you can call this method for example in BeginPlay() or in Tick() or anywhere you want and it will show you the components of your actor.

access a variable from level blueprint in unreal engine 4

I Have a variable that updates every time i move my cube in the level blueprint , now i want to access this variable from multiple class blueprints , what do I do , I tried casting to gamestate but didn't succeed , I am really new to ue4 if you could explain in details please
edit: sorry for not adding details ,
The var I want to access is an integer named cube_side that tells me what side the cube is on every time I move , all of this happens in the level bp , I want to access this variable to see what side the cube is on from other class blueprints ->
here are some details in a picture
I know it's not good to code everything in the level blueprint , but it's too late now , I only need to transfer the var cube_side to other class blueprints so the other object can change depending what side the cube is on.
Create an Actor Class for your logic/functionality. Then use Get all actors of class (choose your class) -> Get a copy -> get variable
Communication with the level blueprint is rather tricky in UE4, since they are not as persistent as e.g. the GameMode, and therefore shouldn't be accessed directly (Imagine older games like Final Fantasy where a new level was loaded every time you stepped outside a boundary, so relying on it could potentially break your actors or crash the game due to nullptrs).
It's a little hacky, but works:
Move the variable inside the cube-blueprint. Add an event dispatcher to the cube, if it is moved, call it and pass the variable in.
Select the cube in the editor, open the level blueprint, right-click, "add reference to selected actor" (the cube must be part of a blueprintclass, not only a static mesh dragged in, though), and bind the event dispatcher inside the Level BP.
Create a function inside every blueprint that needs access to the variable, which does whatever it should do, depending on the variable.
The custom event of the Level Bp (that was bound to the Event Dispatcher of the cube), needs references to all actors that have to work, when the variable changes and call each Actors function (you can get the references like you got the one from the cube)
Then, every time the variable changes, the Level BP is notified, the custom Event is executed and this custom event calls all the actor's functions.
Event Dispatchers explained
This is a huge wastage of functions/code, since you only need it for this one level and may never use it again. Avoid this in the future, by not relying on the level BP so much.
You can use GameStateBP to create and store all variables that you need in game, in GameModeBP create functions to get and set this variables via Get Game State function and then function Cast To GameState and then logic. After that from any blueprint access it using Get Game Mode -> Cast to you GameMode -> use your function to set or get data from GameState.

Should I use Start or Update to call the given method in Unity3d

1.I have a class in which I have a method called ProjectileMotion() with return type IEnumerator and this method is being called from Start().
2. The above script is attached to a prefab that is instantiated from another class.
Problem:
In IENumerator ProjectileMotion() method, I need to have updated position of an object which is moving continuously,so I declared
//assigned the o=gameobject to it and it is moving continuously
Public Transform Target;
In ProjectileMotion(), if I do Target.transform,position, it gives the starting position only and not where it was at the time of instantiation of the prefab to which this script is attached, However, I am able to get the updated position of Target in Update method(checked using Debug.Log).
But I can not call the ProjectileMotion() in Update method of course, what should I do to get updated position of Target every time the prefab is instantiated and so the script is called.
Simply put ...
If you want the code to execute when the component is "started" then call it on start.
OR
If you want the code to execute each frame after the component has started then call it on update.
Judging by the name of this method I would think this is something that updates the position of a projectile after a gun has instantiated it.
The position being updated is likely a per frame operation so.
I would put this in the update method.
EDIT:
UNLESS ...
Does this function do a multiframe animation?
Unity has the concept of coroutines that allow to do certain actions of several frames. in this case you might be better off doing something like this in your start method ...
StartCoroutine(ProjectileMotion)

How do I add trusted code to a plone 4.x product that can be used by or as a workflow transition script?

I am trying to construct a workflow that can be assigned to arbitrary containers and will have the following behavior. When the container makes the transition from state A -> A', the contents of the container should be checked for their state and moved to a new state that depends on their present state. In other words:
obj1: in state 'a' would be transitioned to 'a*'
obj2: in state 'b' would be transitioned to 'b*'
and so on...
obj1 and obj2 are following the same workflow that branches to a number of final states (approved, denied, alternate, etc...)
I know how to do this, if I can trigger my python code as trusted code. Unfortunately, I have not been able to figure out how or where to put the code in my product so this will work. I have found references to using "external methods", however that seems to be going away. Also I want the code to reside in my project.
I think this is probably simple and I am overlooking something. Help with how to put this in my project or another route to achieving the same goal would be welcome.
The scripts support for DCWorkflow only supports through-the-web-addable objects, which limits you to External Methods there.
A better bet is to use workflow events instead. For each workflow transition, two events are fired:
Products.DCWorkflow.interfaces.IAfterTransitionEvent
Products.DCWorkflow.interfaces.IBeforeTransitionEvent
If you subscribe to either of those events, you can then filter on the correct workflow and transistion to react to transitions from trusted code.
Each event fired has the following attributes:
object: the workflowed object
workflow: the current applicable workflow object
old_state: a Products.DCWorkflow.States.StateDefinition object
new_state: another Products.DCWorkflow.States.StateDefinition object
transition: a Products.DCWorkflow.Transititions.TransitionDefinition object
status: a dictionary with the current workflow variables
kwargs: a dictionary of extra arguments passed in to the change-transition call.
Register a subscriber using ZCML:
<subscriber
provides="zope.component.testfiles.adapter.IS"
factory=".youreventsmodule.aftertransition_handler"
for="Products.DCWorkflow.interfaces.IAfterTransitionEvent"
/>
or, because the transition events are object events, listen only to the transition event if it applies to your objects:
<subscriber
provides="zope.component.testfiles.adapter.IS"
factory=".youreventsmodule.container_aftertransition_handler"
for=".interfaces.IMyContainerType
Products.DCWorkflow.interfaces.IAfterTransitionEvent"
/>
which registers your handler only for transition events on objects with the IMyContainerType interface only.
The handler would be:
def aftertransition_handler(event):
# handle all transition events, ever
or, when limiting it to one object interface:
def aftertransition_handler(obj, event):
# handle all transition events for our container interface