How do you set the size of an array that is exposed in Blueprint from within Blueprint? - unreal-engine4

Is there a way to expose an array of undetermined size to the blueprint editor so that the level/game designer can adjust the size of the array?
In my example, I want an array of gunshot sound effects.
In my header file I have this:
UPROPERTY(EditAnywhere)
USoundBase* MuzzleSound[5];
... but I don't know how to do it without having to already know the size.
Over in BP I want some way to be able to adjust the size to add even more if desired:
Is this possible?

You can use a TArray. TArrays are the default array the editor uses within blueprints.
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TArray<USoundBase*> MuzzleSound;

Related

How to create shapetext using Java

I am trying to create shape texts directly using codes as the number of shapetext i need may vary.
I tried using the code below, and I created the shapes in a collection (with type shapetext). When I use "traceln(text.getX());" it prints 2500 but I do not see the text anywhere on the screen. May I understand what I have done wrongly and how can I make the shapetext be shown? Do I have to add shapetexts into my network/level and initialize it?
Thank you for your help!
ShapeText text = new ShapeText(SHAPE_DRAW_2D3D, true, (double) 2500, (double) 3000, (double) 0, 0, black, "testing", new Font("SansSerif", Font.BOLD, 100), ALIGNMENT_CENTER );
You have successfully created the text, but you need to add it to the presentation to be shown
Simply add
presentation.add(text);
An alternative option if you have an undetermined amount of texts is to rather create a single text object and then replicate it as many times as you want to show it. Once you add a replication to a presentation object a local variable called index is now available for you to use in many of the fields.
Use this in the dynamic text field to get the values you want to display (like in the example below I stored the texts in a collection)
And you also use this index to change the position of the text (See what I have done in the Y coordinates)

Alternative to simulink transparent subsystem

I need to organize a set of elements in simulink. The first method is to create a subsystem. The problem with subsystem is that the elements inside it are no longer visible. An alternative method is to create a colorized box and put it behind a set of elements as a background. It makes a lot of troubles during selection of elements.
The ideal method is to have a subsystem which is transparent but you can see the elements inside it. So you can make it large and see inside it without opening it.
What is the feasible alternative method?
Knowing that there is no support by simulink doing this, the only possibility would be to use a mask icon which shows the content. The following is a very rough prototype for the mask code:
model='s1/Subsystem';
loc=fullfile(pwd,[model,'.png']);
print(['-s' model], ['-dpng'], '-r300', loc);
image(loc);
port_label('input',1,'In1');
port_label('output',1,'Out1');
Obviously this prototype has multiple issues which must be addressed when really using the code:
Remove the hard-coded directory.
Set in- and outports automatically.
create required folder structure. (folder s1 must be created once manually)
Scale the subsystem block to make the image look good
work properly if pwd is not the directory the model is stored in
You can make use of the 'Icon Drawing Commands' of the mask parameter's tab 'Icon and Ports' :-
Take a screenshot of the logic gates you want to be visible on the subsystem (the ones with a blue background color shown in your question)
Save the picture e.g 'mylogic.png'
Write this command in the 'Icon Drawing Command' field of Icon and Ports image(imread('Pause_Icon.png'));
You're done. But yes, make sure you have the picture file in the same folder as your model or simply add the folder containing the picture on your path.
Of course, if you update the blocks inside the subsystem, you'll have to update the mask icon with the new screenshot.

How can I set a custom size for the RichTextArea.Formatter.setFontSize() in GWT?

Using the RichTextArea in GWT, It looks like I can only change the font size to one of the values: LARGE, MEDIUM, SMALL, etc (RichTextArea.FontSize), but I want to be able to setFontSize of the RichTextArea.Formatter to a specific size in pt or in px.
How can I achieve that?
I've been digging a bit on this, and it would seem that it is unfortunately not possible, because browsers are limited in their handling of font sizes in the rich text editors. In particular, Firefox generates the (deprecated) <font size="x"></font> element when the font size is changed, and the value of x can be only in the 1-7 range.
If you have a look at the setFontSize method in RichTextAreaImplStandard (GWT source code), you'll see that it ends up calling the execCommand javascript function, which in the case of FontSize only accepts values in 1-7:
http://msdn.microsoft.com/en-us/library/ms536991%28VS.85%29.aspx
You can actually achieve that using string manipulation of the HTML code.
So if you are not using the background color property of the RichTextArea then what you have to do is to replace the "background-color=RED" to "font-size=12px". And then set it back to the RichTextArea object as setHTML().
This works fine as I've implemented this functionality in one of our production application..
Thanks,
Pratik.

is it possible to replace images in an array dynamically

hi i am new to iphone.what i am need is to place a 20 images names in an array . if i place those images in an array whether it is possible or not to change replace the first image by last means changing the positions of images dynamically if it is not possible pls suggest in what way i can done this. pls post any sample code thank u
Use NSMutableArray. It has methods like
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
- (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2;
It does not matter whether your objects are strings or images or whatever. It is possible to change the objects in a mutable array.

iphone uiimage tag - can you use strings?

quick question...
I have a series of buttons, each with a tag. I click the buttons which individually create a uiimageview based on the tag number. So this tag number, say 43 is passed and a new uiimageview is created using 43.png
All this is working nicely and I can remove the created images by clicking on them...
..but... I'm now wondering how I can remove all these created images all at once. So I have say 4 images which were all created as a result of clicking the buttons.
my question is this: can I use a string to identify these "created" images some how? I thought about using a tag for them starting with 99 maybe? so 991, 992, 993 etc. but this doesn't seem like good coding. In the past, and indeed in Flash, I used a tag of item1, item2... then in the code, I simply loop through ALL tags on the screen starting with "item" and remove them.
any ideas on the best way to tackle this??
Thanks
You could simply store a reference to all the created images as elements in an array kept as an attribute of the viewController.
Alternatively, this is the sort of problem that can be handled with a subclass. You can just create a subclass of UIImage with some sort of identifier attribute and use that to remove them.
Seems like you could just loop through the subviews array, look at the tag property of each one, convert each to a string, and use NSString startsWith: to remove those that match your pattern.
But I think it would be easier to just keep your own list of created images, and delete them when desired.