Show Waveform in Timeline using Extendscript for After Effects - extendscript

I'm creating a script that will create a whole bunch (hundreds) of AE comps and fills them with items etc.
When I go in to edit these comps I always set the same view options over and over before doing the editing. Namely, I show the opacity (shortcut: T - ) then hold shift and press 'LL' to show the waveform, then wait a second and press 'L' again to show the audio keyframes.
I'm looking to set this as the default view for every comp I enter... How can I do this?
I've tried something like:
var item = app.property.activeItem;
item.property("Opacity").enabled = true;
But no luck!

Related

How to create a scalable multi-line button in Godot?

A Button in Godot can only hold a single line of text. I can overcome this limitation by placing RichTextLabel node inside the button.
Now the button can contain more lines of text, but its height doesn't change automatically when more lines are needed. Instead the text just overflows:
Of course I can manually resize the button to be higher, but I'd like this to happen automatically depending on the amount of text inside. Specifically, I'm generating a list of these buttons programmatically and showing inside a HBoxContainer, with some buttons having longer and other shorter text.
Is there a way to achieve this with Godot layout tools?
Since the Button is in a Container, it is in control of its rect_size. The best we can do is specify a rect_min_size. There is no layout preset to have a Control depend on children Control. So, to answer the question as posted: No, we cannot achieve this with Godot layout tools. We need some scripting.
We need to set the rect_min_size for the Button depending on the RichTextLabel. We can ask it for the height of its content with get_content_height. Which also means we need to set the width beforehand. However, it will not update right away when we set the text (we are going to use yield).
Apparently you don't want the Container to control the height of the Button. If that is the case, I think you can remove all the flags from size_flags_vertical.
About the width, since as I was explaining before we need to set the width to get the height… I suggest you let the Container expand the width of the Button as much a posible. Which mean setting both the Fill and Expand flags on size_flags_horizontal.
Then, with the RichTextLabel properly set to take as much width of the parent Button as possible, you can read it height, and use it to set the height of the rect_min_size of the Button.
One more thing: you want to set the mouse filter of the RichTextLabel to Ignore or Pass, or it will prevent pressing the Button.
This is the code I came up with:
var b := Button.new()
b.size_flags_vertical = 0
b.size_flags_horizontal = SIZE_EXPAND_FILL
add_child(b)
var l := RichTextLabel.new()
l.mouse_filter = Control.MOUSE_FILTER_IGNORE
l.set_anchors_and_margins_preset(Control.PRESET_WIDE)
l.text = "Some\nMultiline\nText"
b.add_child(l)
yield(get_tree(), "idle_frame")
b.rect_min_size.y = l.get_content_height()
I'd like this to happen automatically depending on the amount of text inside
Sadly changing the text does not resize, nor change the minimum size of the RichTextLabel. And RichTextLabel does not have a "text changed" signal. Nor "bbcode text changed" signal. Furthermore, it might not be feasible to intercept these properties (see append_bbcode et.al). It is proabaly easier to do with a regular Label.
Anyway, what I'm going to suggest for this is to make a Control that wraps the RichTextLabel, offers whatever interface you actually need, and in any method where you change the text, afterwards, you do the equivalent of this:
yield(get_tree(), "idle_frame")
b.rect_min_size.y = l.get_content_height()
(Godot 3.x)
Without using scripting, it is also possible to achieve the same goal by wrapping both nodes as sibilings within a container, for example a MarginContainer. Enable the RichTextLabel's fit_content_height property, which will result in the label expanding the container's area as much as necessary, which will in turn resize the Button.

How can I turn a popup menu invisible?

I'm working with Progress release 11.6, appBuilder and procedure editor.
I'm creating a new window, based on another one. That other window contains a browser, on which a popup menu is attached.
In my copy I don't want to see the popup menu at this moment (in other words, I'd like to disable it, so that the user does not see it).
I have tried putting VISIBLE to FALSE, HIDDEN to TRUE, but I'm always getting into problems.
My code looks as follows, does anybody know how I can turn the popup-menu invisible?
DEFINE MENU popup-menu-browser
MENU-ITEM m_Copy LABEL "Copy" ACCELERATOR "CTRL-C"
MENU-ITEM m_Cut LABEL "Cut" ACCELERATOR "CTRL-X"
...
browser-object:POPUP-MENU = MENU popup-menu-browser:HANDLE
// not working:
MENU POPUP-MENU-browser:HIDDEN = TRUE.
You need to remove the popup-menu:
MENU POPUP-MENU-browser = ?.
Or make it insensitive:
MENU POPUP-MENU-browser:SENSITIVE = FALSE.
Complete example:
define browse br with size 40 by 10.
define menu mb
menu-item mhide label "Hide"
.
on choose of menu-item mhide do:
browse br:popup-menu:sensitive = false.
end.
on " " anywhere do:
browse br:popup-menu:sensitive = true.
end.
browse br:popup-menu = menu mb:handle.
define frame fr
br
with
size 42 by 12
view-as dialog-box
.
enable all with frame fr.
view frame fr.
wait-for close of frame fr.
Beware that when switching between popup menus, you will lose the values of check boxes - see knowledge base article 000054795

How can add space-key to jump for Platform behavior in construct 2?

I'm using the Platform Behavior in Construct 2 for a Windows 10 game. In addition to the arrow key, I would like to use the Space bar to get the sprite to jump. Can I tell it to call into the Platform behavior somehow or get it to let me map space bar as well as up arrow to 'jump'?
You certainly can. You can use an action called "Simulate Control" to simulate pressing left, right, or up. So as your event, use Keyboard->on Key Pressed (Space Bar). Then for the action Player->Simulate Control (Up Arrow). This will allow you to press space bar to have your character jump. Additionally, you can turn off default controls for the platform behavior and do custom controls for left, right, and up using the same strategy.
The best way to go about doing this is by adding an event that handles the Space Button. Make sure to add the keyboard object in your layout, and in the event sheet, you want to make an event that handles the keyboard -> on key pressed (choose the spacebar when asked) -> choose whatever object you want to jump with the Platform behavior -> Set Vector Y to whatever increment you'd like to jump. Be sure to list this value as negative. The y-axis in C2 is inverted, so negative numbers mean up.
Hope this helps!

Cadence Virtuoso Layout L phantom objects

I have a cell (call it A) which is used once in a hierarchically higher cell (call it P). When I place A in P, its borders are rather larger than the actual content of A. When I descend to A and zoom-fit, it is way zoomed out, indicating there is something present way out on the edges.
I may have dragged objects there at one point but currently there is nothing visible. It is driving me crazy in terms of aligning objects, etc.
Is there any way to clean this up or something?
If I recall Cadence used to have a problem with leaving steiners behind when you moved routes. They are not visible but the db treats them as real objects for the bbox calculation. According to Cadence, deleting the objects should not harm anything. Open the layout in edit mode and paste this code into the CIW. This will delete all the steiner objects in your layout. If this was the root cause after saving you should see the bbox return to normal.
cv=geGetEditCellView()
foreach( item cv~>steiners
dbDeleteObject( item )
)
This thread may be considered "dead," but hopefully this helps.
It is possible the layers that are not visible are turned off.
To turn them on, go to the layers pane on the left. (If it is not there you can turn it on by going to Window —> Assistants —> Layers)
You can then click the drop down arrow in the top right corner and click Edit Valid Layers.
Then, click all valid in the Set Valid Layers popup. Click Ok.
Finally, check the Used Layers Only checkbox in the Layers pane. Look for any layers that weren't there before that you don't need.
Usually it happens when you draw the cell in LayoutXL, particularly when you insert pins.
Layer and purpose in these pins are selected separately for some reason, that is why it is easy to enter "impossible" combination.
Nothing happens, then you do it again and continue drawing. But there are several invisible squares that will continuously frustrate your inner perfectionist. You do the following:
Open this cell's layout, switch to Virtuoso window and enter:
lppList=list()
then:
foreach(shape hiGetCurrentWindow()~>cellView~>shapes if( (member(shape~>lpp lppList)==nil) then lppList=cons(shape~>lpp lppList)))
You have created the list with all layers in this layout, you can view it by entering:
lppList
You'll get something like this:
(("NW" "drawing")
("NP" "drawing")
("weird" "guy")
("M1" "pin")
("M3" "pin")
)
If you find a weird guy in this company, just enter the following command:
foreach(shape hiGetCurrentWindow()~>cellView~>shapes if((shape~>lpp == list("weird" "guy")) shape~>lpp = list("prBoundary" "drawing")))
If you see that some squares, labels (or whatever unseen before) appears as prBoundary, just delete it, save, and your layout will be small and shiny again.

Why the UI keep flicker?

I have a project which have three dialog, Let's say A, B, C.
And A contain B & C, B contains C.
They all are inherited from a DialogBase class
and have a setBitmap function to set a background image.
And I have add the relationship that every time drag on C, B will drag as well.
and B is a transparent dialog!
When onLbuttonDown is triggered, I will set this
m_pParent->ModifyStyleEx(0, WS_EX_TRANSPARENT); which make that the B dialog is transparent.
The problem is : if i set this, the dialog B is transparent, but when I move the B, it will keep flicker.
But if i comment
m_pParent->ModifyStyleEx(0, WS_EX_TRANSPARENT);
Then the dialog B will not be transparent, but it will not flicker.
Can someone give me a solution ?
WS_EX_TRANSPARENT is a hard style to understand. It probably doesn't do what you think it does.
When you set WS_EX_TRANSPARENT for a window, you're not telling Windows to make it transparent - you're telling Windows that you won't be painting the entire window, so it has to draw the windows underneath before it draws your window. All you're really doing is changing the order of the WM_PAINT messages to the various windows.
You're seeing the flicker every time the dialog A repaints.
If you really need to see parts of dialog A through the background of dialog B, you can do some special processing in your OnLButtonDown. Start by setting the visibility of dialog B off, then create a bitmap, assign it to a DC, and have dialog A draw to that DC. Now you can set dialog B to visible again, and every time you paint it you start by copying the appropriate section of the saved bitmap to the background.

Resources