How can I hide certain Elements when taking a Screenshot - cocos2d-x

In my project I've got a gameCamera which is used to diplay the things inside my level and a uiCamera which displays the ui-elements.
I'm trying to take a screenshot which only consists of the level-elements and not the ui.
My attempt was to hide the uiCamera which works but it also briefly hides the ui for the user and it doesn't look very nice.
This was the code:
// hide the camera
this->getUiCamera()->setVisible(false);
utils::captureScreen([](bool captureBool, std::string path) {
// do something to make UI visible again, left this out because its not really relevant
}, "level_screenshot.png");
I also tampered around with renderTexture but that didn't work out well probably because of the parallax effect I use in the level.
Is there any way I can take a screenshot while hiding the uiCamera? Is it possible to take a Screenshot of only the gameCamera itself, maybe by using renderTexture?
My cocos version is 3.9

You can do it by adding all the Nodes(which should not be present in the screenshot) in an Array, disable the visibility of all nodes just before taking the screen shot. Enable the visibility after the screen shot taken.

Related

Why would bootstrap dropdown nav button work in all screen sizes except for one?

I have this site here (using bootstrap 4.1.2):
https://secure2.convio.net/cco/site/SPageServer/?pagename=RFL_NW_QC_Impact
And for some reason the dropdown button in the top right works on mobile, and on most of desktop but screen sizes between 786px to 991px won't work, any smaller or larger and it works perfectly.
Someone else created this page so I'm trying to help fix the issue but I can't pinpoint what's causing it. Doesn't seem like a situation where z-index would need to be used because it can still be clicked it just doesn't expand.
I checked the console and fixed the errors that came up but that still didn't solve the issue. Normally it's on mobile where I have this problem because something is overlapping the button but it doesn't seem to be the problem this time.
any help would be greatly appreciated.
thanks!
Opening/closing the menu is done by two custom functions contained in a <script> tag placed in <head>, on lines 187 and 195, respectively.
Each of them has the entire body of code wrapped in a condition:
if ($(document).width() <= 768) {
...
}
Change both conditions to if ($(document).width() <= 992).
You also have another, potentially bigger problem:
On line 391, you have …</script>, ending the current script abruptly, which is a sign that code was copy/pasted from a browser source code, without properly viewing the entire source code (when viewing large chunks of code, Chrome shows the first n lines and hides the rest under …, which acts as a link to the rest of the code). I'm surprised your console isn't bleeding heavily.
The proper way to retrieve the source of a particular tag is to right-click on it in dev-tools and select "Edit as html". In the opening editor window, you can Ctrl+A, Ctrl+C to copy the entire contents of that tag.

Autodesk Viewer UI Code Location and Edit Suggestions Needed

I need some help tweaking the Autodesk Viewer UI. I am working on the files as provided by a localised version output from http://extract.autodesk.io/.
I have not done any custom editing. I need help locating the relevant code and suggestions for the changes in the following areas:
The Model Browser docking panel. This opens by default with the first group in the tree Expanded (see picture). I want this first element and all other elements to open by default as Collapsed, so just the parent names are shown.
Staying in Model Browser. The Scroll Bars, (seen when model elements names are listed beyond the Model Browser window size) display correctly in the Opera and Chrome browsers,
however, they display unstyled as wide windows style scroll bars in the Firefox browser. What is needed for Firefox to display scrollbars as intended?
What code might override camera zoom property AFTER correctly loading default zoom value ?
The viewer version from http://extract.autodesk.io/ imports the scene camera properties for the start view ok, but overrides the Zoom property with another value shortly after intial page load.
1.I want this first element and all other elements to open by default as Collapsed, so just the parent names are shown.
Unfortunately far as I know there's no straightforward, native config option in Viewer to achieve this. However you can:
Hook an one-off click listener onto Model Browser button to programmatically fire a click on the corresponding notes you'd like to collapse, or directly add ‘.collapsed’ class to them. You can get a hold of the nodes either by their lmv-nodeid or their label text:
<div lmv-nodeid="9" class="collapsed group visible">
<lmvheader style="padding-left: 13px;">
<div class="visibility"></div>
<label>Switch:1</label>
</lmvheader>
</div>
Extend and build your own browser using the instanceTree and Autodesk.Viewing.UI.DockingPanel, see an example here
2.What is needed for Firefox to display scrollbars as intended?
Here is a great answer to your question. But looks like the status quo is still far from perfect, with no definite hack discovered so far. So again for a thorough solution you'd need to create your own styling (can do so with the help of something like) and apply them to .docking-panel and append .model-structure-panel or any other panels you'd like to narrow the scope to.
3.What code might override camera zoom property AFTER correctly loading default zoom value ?
This should be the code you are after.
You can manipulate camera with viewer.autocam.goToView( newView ), and see below for a sample view config:
const newView = {
position: newPosition,
up: currentView.up,
center: newCenter,
pivot: newPivotPoint,
fov: currentView.fov,
worldUp: currentView.worldUp,
isOrtho: (currentView.isOrtho === false)
}

how I make my opera browser run the mouse pointer

So I have developed a basic website which runs on old feature phones as well as smartphones. Now on a feature phone, at times, a mouse pointer appears via which it makes it easier for the user to scroll and select certain options on the website. I have tried replicating the process but I have been unable to do so. It always happens randomly. I would love to know what I can add to my code to get the mouse pointer permanently active. Keep in mind I cant use Javascript as the feature phone I am testing on does not have JS and this is also the case for most of my users.
You just need to use cursor: pointer in the CSS for whichever element you want to display the cursor for. For the whole document, that would be:
body {
cursor: pointer;
}
Hope this helps!

Google Chrome dev tools variable tip bubble too little to see the content

I have just now sended the following message to google chrome developer:
Chrome version: 54.0.2840.59 m
As you know, when debugging a web page with javascript, the Chrome
debugger allows to pause the execution of the code on breakpoints. In
this moment is possible to move the mouse onto a variable to see what
value has in: when the mouse is on the variable chrome code
inspector/debugger shows a little tip showing the variable value.
The problem is that such little bubble tip sometimes is toooo little
and it is not possible to see the content.
Please correct its size (make it resizable) to make possible to read
its content or it isn't useful.
Thanks
Anyone else has noticed the same issue?
Someone has solved it?
Edits
Before the last update was working perfectly (or at least I didn't see anything wrong in its behavior!), but now the following image shows the issue that sometimes happens:
As shown into the above img, part of the bubble tip content is shown, part is hidden, and it is not possible to scroll the bubble tip neither up|down nor left|right: scrollbars are greyed. Sometimes scrollbars don't appear at all.
You can scroll the tool tip as per the animation below:
A possible workaround could be adding the variable to the watch list:
Procedure:
right click on the variable
Into right click menu click on "Add selected text to watches"
This allows to keep an eye on the watchlisted var contents, even if they hidden into the bubble tip.
It is not completely handy, but works.

PyGTK: Packing widgets before tabs in a gtk.Notebook

Basically, what I want to do is put some buttons before the tabs in a gtk.Notebook. I tried making my own notebook type widget and it worked well, but it would have required lots more work to make it as flexible as I would like, also it wasn't as efficient.
Here is a mock-up of what I'm trying to achieve: http://imagebin.ca/view/84SC0d.html
Any ideas would be much appreciated, thanks.
Ben.
You might be interested to know that this functionality has been added in GTK 2.20, see "Changes in GtkNotebook" in the following announcement: http://mail.gnome.org/archives/gtk-devel-list/2010-March/msg00132.html
It's a hack, but you can put your widgets on a separate tab, and then prevent the tab from being clicked by registering the following switch-page event for the notebook:
def onTabsSwitchPage(self, notebook, page_notUsableInPython, pageNumber):
# Don't allow to switch to the dummy tab containing widgets
if pageNumber == <put correct tab number here>:
notebook.stop_emission("switch-page")
Note that this doesn't look good with all GTK themes, but it works...
I don't think there's any way to do it without making your own notebook widget. There are a couple of hacks. One was posted by AndiDog. Another is to hide the tabs altogether (notebook.set_show_tabs(False)) and make a toolbar with buttons above the widget, with your buttons on the left, plus one button for each tab in the notebook that switches to that page.
Instead of making your own notebook-type widget from scratch, you could inherit from gtk.Notebook, overriding some of the methods like expose_event, size_request, and size_allocate, in order to deal with two types of container children: pages and buttons. I don't know how to do this in PyGTK though, only in C.
You might also consider whether the buttons in the tab space are really what you want. What if the user resizes your notebook small enough that some of the tabs disappear? Where do the previous tab/next tab arrows go? What happens to the buttons?