UE5 How to set output pin values in customized AnimNode? - unreal-engine4

I have a customized AnimNode, I overrided CreateOutputPins func:
virtual void CreateOutputPins() override
{
const UAnimationGraphSchema* Schema = GetDefault<UAnimationGraphSchema>();
CreatePin(EGPD_Output, Schema->PC_Struct, TEXT("HeadPose"), TBaseStructure<FVector>::Get(), /*bIsArray=*/ false,
/*bIsReference=*/ false, TEXT("HeadPose"));
CreatePin(EGPD_Output, Schema->PC_Struct, TEXT("EyePose"), TBaseStructure<FVector>::Get(), /*bIsArray=*/ false,
/*bIsReference=*/ false, TEXT("EyePose"));
Super::CreateOutputPins();
}
Then I can get a node like this:
Which gives me out Vector output.
Question is: How Can I set the output values calculated from my Node?

Related

I am trying to use a List within dart to Store information

How can I retrieve this information as when I am testing it using print it is returning the following error?
I have searched online to try and find a solution but alas for the past 30 minutes i have not been able to find one. If there is an easier and more efficient way of storing information then please let me know.
Apologies as I am still learning dart, moving from JS.
List<Object> chosenSelection = [
[
'Advanced Higher', //[0][0]
false /**Enabled? */, //[0][1]
[
'Style',
'MelodyHarmony',
'RhythmTempo',
'TextureStructureForm',
'Timbre',
] /**Categories */, //[0][2][0-4]
],//[0]
[
'Higher', //[0][0]
false /**Enabled? */, //[0][1]
[
'Style',
'MelodyHarmony',
'RhythmTempo',
'TextureStructureForm',
'Timbre',
] /**Categories */, //[0][2][0-4]
]
];
print(chosenSelection[0][0]); //Output: 'Advanced Higher'
print (chosenSelection[0][2][4]); // Output 'Timbre'
Resulting error:
type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'List' of 'function result'
I am trying to access the data 'Advanced Higher' and then 'Timbre' within the variable.
I'm not sure what's the question here, but this code doesn't compile for 2 reasons:
You're missing a closed bracket in the second print;
You're trying to access the elements of an Object as if it is a nested List.
You are trying to implement a 2d and 3d list. But you have declared a 1d list.
In order to declare a 2d list you need to declare it as List<List<Object>> and for a 3d list: List<List<List<Object>>>
So you need to declare List<List<List<Object>>> chosenSelection, and then
print(chosenSelection[0][0]); //Output: 'Advanced Higher'
print (chosenSelection[0][2][4]); // Output 'Timbre'
I ended up settling for making the information part of a class.
class ChosenLevel {
String level;
bool overallToggled = false;
Map categories = {
'Style': true,
'MelodyHarmony': false,
'RhythmTempo': false,
'TextureStructureForm': false,
'Timbre': false,
};
Color _color;
ChosenLevel(this.level, this._color);
get categoriesNumber {
return categories.length;
}
specificCategory(index) {
switch (index) {
case 0:
return 'Style';
case 1:
return 'MelodyHarmony';
case 2:
return 'RhythmTempo';
case 3:
return 'TextureStructureForm';
case 4:
return 'Timbre';
/* default:
throw ("Something strange happend"); */
}
}
toggleCat(c) {
this.categories['${c}'] = !this.categories['${c}'];
}
toggleLevel() {
this.overallToggled = !this.overallToggled;
}
#override
String toString() {
return '{${level}, ${categories}}';
}
}

Dynamically set form field values in React + Redux

My app's store has a store.authState subtree. In this subtree, there are three things, an authToken, an isFetching boolean and, most importantly a fields object. My form contains two fields : username and password.
I have created an action called SET_FORM_FIELD_VALUE which should generate and update each field's state as they are changed by the user.
I would like my SET_FORM_FIELD_VALUE to update the fields object. If a user normally fills in both username and password fields, my store.authState should look like this:
{
authToken: undefined,
isFetching: false,
fields: {
username: "Brachamul",
password: "azerty123"
}
}
However, it seems that my current code actually just overwrites everything and I end up with :
{
field: {
username: "Brachamul"
}
}
The data in the field changes based on what field I last edited. It's either username or password.
Here is my code :
switch (action.type) {
case 'SET_FORM_FIELD_VALUE':
let field = {} // create a "field" object that will represent the current field
field[action.fieldName] = action.fieldValue // give it the name and value of the current field
return { ...state.fields, field }
How can I change it to fix my issue ?
Your return is wrong, it should be something like this
switch (action.type) {
case 'SET_FORM_FIELD_VALUE':
return {
...state,
fields: {
...state.fields,
[action.fieldName] : action.fieldValue
}
}
}
Hope it helps.
i used change() from 'redux-form'
which only re rendered that specific form input, and isued it pretty often.
everytime the user clicked a dropdown menu it suggested values in 2 input fields
i abstracted away the html from the anwser and some other stuff.
import { FieldArray, Field, change, reduxForm } from 'redux-form';
class WizardFormThirdPage extends react.component{
runInject(target,value){
target.value= value; // sets the client html to the value
// change (formName, Fieldname, Value) in the state
this.props.dispatch(change('spray-record', target.name, value))
}
injectFormvalues(){
var tr = div.querySelector(".applicator-equipment");
var name = div.querySelector("select").value;
if(!name.includes("Select Employee")){
// var inputs = tr.querySelectorAll("input");
var employeeDoc= findApplicatorByName(name); // synchronous call to get info
tractor = tr.querySelector("input")
sprayer = tr.querySelectorAll("input")[1];
// here i send off the change attribute
this.runInject(tractor,Number(employeeDoc.default_t))
this.runInject(sprayer,Number(employeeDoc.default_s));
}
}
// you have to connect it get the dispatch event.
export default connect(state => ({
enableReinitialize: true,
}))(reduxForm({
form: "myFormName", // <------ same form name
destroyOnUnmount: false, // <------ preserve form dataLabel
forceUnregisterOnUnmount: true, // <------ unregister fields on unmount
validate,
})(WizardFormThirdPage));

LibTiff.net isn't setting the Subject tag

I'm trying to mimic some production code to generate Tiffs with a subject for testing purposes (IE in windows, right click, go to properties and the details tab there is a subject). We place some text we need to reference later in the subject field. The field we use is 0x9c9f which as far as I can find is (Subject tag used by Windows, encoded in UCS2)
Here's the code I'm using to generate the tag
public static void TagExtender(Tiff tif)
{
TiffFieldInfo[] tiffFieldInfo =
{
new TiffFieldInfo(TIFFTAG_SUBJECT, 256, 256, TiffType.BYTE, FieldBit.Custom, true, false, "XPSubject"),
};
tif.MergeFieldInfo(tiffFieldInfo, tiffFieldInfo.Length);
//if (m_parentExtender != null)
// m_parentExtender(tif);
}
public static void GenerateTiff(string filename, int pages = 1, bool encrypt = false, string tag = null)
{
// Register the custom tag handler
if (m_parentExtender == null)
{
Tiff.TiffExtendProc extender = TagExtender;
m_parentExtender = Tiff.SetTagExtender(extender);
}
// Open the output image
using (Tiff output = Tiff.Open(filename, "w"))
{
//...other code to generate tiff
if (tag != null)
{
byte[] bytes = UnicodeStr2HexStr(tag);
output.SetField(TIFFTAG_SUBJECT, bytes.Length-1, bytes);
}
// Code to actually write the image ....
output.WriteDirectory();
}
output.Close();
}
Basically, the tag (code wise) appears to be in the tiff but the windows properties dialog never shows it. Anything special needed to get this in place?
You are passing a bytecount, but set the passCount flag to false.
If you want to pass the count, use these lines at their correct positions:
// Your FieldInfo
new TiffFieldInfo((TiffTag)40095, -1, -1, TiffType.BYTE, FieldBit.Custom, true, true, "XPSubject")
// Your Input
byte[] test = Encoding.Unicode.GetBytes("Test3");
tiff.SetField((TiffTag)40095, test.Length, test);

IDbSetExtensions.AddOrUpdate not setting ID in database

Using Entity Framework Code First's Seed method, I have been making calls like this to add new objects to a table.
private void SeedDatabaseActivities(SiteDbContext context)
{
context.Activities.AddOrUpdate(new ActivityDefinition
{
Id = 605,
Name = "bicycling, >20 mph, racing, not drafting",
UseSteps = false,
UseDistance = false,
Category = "bicycling",
Mets = 16
});
}
This was working great for months. Recently, this no longer sets the ID, correctly. I have been searching for why this would change, but haven't been able to find the issue.
What would cause this behavior?

Eclipse UML2: obtain value of a property defined in a profile

I'm new to eclipse UML2 and get stuck in the following problem.
I defined a profile with two stereotypes: ServiceRequest and TransitionEdge. ServiceRequest extends the Action metaclass with two additional properties (cpu, memory), and TransitionEdge extends the ActivityEdge metaclass with the additional property called "probability". All these properties are of type float defined as a PrimitiveType.
The I created an activity diagram that have the profile and stereotypes applied. In the activity diagram, each edge is a TransitionEdge defined in the profile, and a value has been assigned to the probability property.
Having the profile and the activity model, I use the following Java code to load them.
// Load the profile
URI profileUri = URI.createURI(PROFILE_NAME);
ResourceSet profileSet = new ResourceSetImpl();
profileSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
profileSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
profileSet.createResource(profileUri);
Resource profileResource = profileSet.getResource(profileUri, true);
Profile profile = (Profile)EcoreUtil.getObjectByType(profileResource.getContents(), UMLPackage.Literals.PROFILE);
Profile sopraProfile = (Profile)profile.getOwnedMember(PROFILE_NAME);
Stereotype serviceRequestStereotype = (Stereotype)sopraProfile.getOwnedMember(STEREOTYPE_SERVICE_REQUEST);
Stereotype transitionEdgeStereotype = (Stereotype)sopraProfile.getOwnedMember(STEREOTYPE_TRANSITION_EDGE);
// Load the model
URI modelUri = URI.createURI(MODEL_NAME);
ResourceSet modelSet = new ResourceSetImpl();
modelSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
modelSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
modelSet.createResource(modelUri);
Resource modelResource = modelSet.getResource(modelUri, true);
Model model = (Model)EcoreUtil.getObjectByType(modelResource.getContents(), UMLPackage.Literals.MODEL);
EList<Element> elements = model.getOwnedElements();
for(Element e : elements){
if(e instanceof Activity){
Activity activity = (Activity)e;
EList<ActivityEdge> edges = activity.getEdges();
for(ActivityEdge edge : edges){
System.out.println(edge.getValue(transitionEdgeStereotype, "probability"));
}
}
}
An exception is thrown when the getValue method is called upon an element.
The following is the error message:
org.eclipse.uml2.uml.internal.impl.PropertyImpl#7a6d6a3f (name: base_ActivityEdge, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)
org.eclipse.uml2.uml.internal.impl.PropertyImpl#255a8ce4 (name: probability, visibility: public) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)
Exception in thread "main" java.lang.IllegalArgumentException: org.eclipse.uml2.uml.internal.impl.StereotypeImpl#442f4161 (name: TransitionEdge, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.ElementOperations.getValue(ElementOperations.java:527)
at org.eclipse.uml2.uml.internal.impl.ElementImpl.getValue(ElementImpl.java:296)
at test.Test.main(Test.java:68)
I couldn't figure out what was going on. Any suggestions? Thanks a lot!!
The Element.getValue(...) method expects the actual Stereotype instance to be passed, that is used with the model.
In the first block, you are retrieving your Stereotype instance from a separate ResourceSet than the one used for the model in the second block. Consequently, the profile is loaded a second time while loading your model and another Stereotype instance is created. You need to pass that one to Element.getValue(...).
This is the safest way to do it:
Activity activity = ...
Stereotype transitionEdgeStereotype =
activity.getAppliedStereotype(STEREOTYPE_TRANSITION_EDGE);
if (transitionEdgeStereotype != null) {
System.out.println(edge.getValue(transitionEdgeStereotype, "probability"));
}
Edit: In this case, STEREOTYPE_TRANSITION_EDGE needs to be the full qualified name of the stereotype including the profile name, e.g. ServiceProfile::TransitionEdge.