Error loading files from Multiatlas in Phaser3 - json

Trying to use the multiatlas feature in Phaser and TexturePacker.
Getting this error:
VM32201:1 GET http://localhost:8080/bg-sd.json 404 (Not Found)
Texture.js:250 Texture.frame missing: 1/1.png
The JSON file actually resides at http://localhost:8080/dist/img/bg-sd.json and I can browse to it. I can also browse to http://localhost:8080/dist/img/bg-1-sd.png.
I'm loading the atlas like:
scene.load.multiatlas({
key: 'bg-sd',
atlasURL: 'dist/img/bg-sd.json',
baseURL: 'dist/img'
});
The 1/1.png frame is also in the file:
{
"textures": [
{
"image": "bg-1-sd.png",
"format": "RGBA8888",
"size": {
"w": 1924,
"h": 2039
},
"scale": 0.5,
"frames": [
{
"filename": "1/1.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 960,
"h": 540
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 960,
"h": 540
},
"frame": {
"x": 1,
"y": 1,
"w": 960,
"h": 540
}
},
I've tried various combinations of the path and baseURL settings but it will not load the file from dist/img.

I think providing both a baseURL and an atlasURL might be conflicting. The baseURL is attached in front of the atlasURL value so you're probably loading something like dist/img/dist/img/bg-sd.json.
Have you tried without the configuration object, like:
this.load.multiatlas('bd-sd', './dist/img/bg-sd.json');

Related

Why does my minecraft location_check predicate not run?

I have followed several tutorials to the letter, and got the "player is_sprinting:true" predicate to work. So I know my fresh new datapack is working.
There are no examples of location predicates anywhere. Videos, wiki, nothing.
I go to a generator and generate the whole predicate, export the whole file, put it in the proper folder, and when I type the path in my tick.mcfunction, Visual Studio Code properly links to it (finally after having to create a new project AND restart my computer to not have the new project auto-fill paths to my old project... for some reason).
It does not detect when a player is within 100 of 0 0 0. It does nothing. Here's what I've tried:
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:player",
"location": {
"position": {
"x": 0,
"y": 0,
"z": 0
}
},
"distance": {
"absolute": {
"min": 0,
"max": 100
}
}
}
}
And...
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:player",
"distance": {
"absolute": {
"min": 0,
"max": 100
}
}
}
}
And...
{
"condition": "minecraft:location_check",
"predicate": {
"position": {
"x": {
"min": -100,
"max": 100
},
"y": {
"min": -100,
"max": 100
},
"z": {
"min": -100,
"max": 100
}
}
}
}
All combined with:
execute as #a if predicate test:homezone run say hi
Or:
execute as #a[predicate=test:homezone] run say hi
And my player is standing in a new map, at 0, 0, 0 with no other functions running. What's my problem?
when using a predicate as a target selector argument, you need to have the namespaced ID. other than that i'm not really sure. if that dosen't help, try asking on the official minecraft commands discord server, they are good with that stuff. https://discord.gg/QAFXFtZ
for example:
#e[predicate=foo:bar]
not just
#e[predicate=bar]
locations are weird, I test in superflat void
What you have in your third predicate with the location_check is almost what I have in mine.
{
"condition": "minecraft:location_check",
"offsetX": -20,
"offsetY": 0,
"offsetZ": -20,
"predicate": {
"position": {
"x": {
"min": 0,
"max": 2
},
"y": 4,
"z": {
"min": 0,
"max": 2
}
}
}
}
This is what I have running in a command block
execute as #p[predicate=test:area] unless predicate test:sneaking run function test:null
This detects player at 20 4 20 to 21 4 21 unless sneaking.

Loading pushpin in the forge viewer does not respect the viewerState

We are using the "Autodesk.BIM360.Extension.PushPin" extension inside the forge viewer to enable push pins.
When a push pin has been added to the model, we serialize the pushpin data and store it in our database. An example of such a pushpin is here:
{
"id": "12",
"label": "12",
"status": "quality_issues-not_approved",
"position": {
"x": 15.324803588519861,
"y": -10.150864635427533,
"z": -5.532972775562976
},
"type": "issues",
"objectId": 24518,
"externalId": "d9a1e318-14d0-4d08-b7ab-6d1c331454c2-002793d1",
"viewerState": {
"seedURN": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6MDQyY2QwMmUtNzU0Yi00ZDY2LTgyYTMtNjBmYjFlOWVjMjcxL2U5ODAxZTA4LTUwZjQtNDc0ZS05ZWU4LTAxYWQ0ZGM0ODFiYl9WMV9Lb25nZXN0aWVuKzMwKy0rVGlsYnlnbmluZystK0clMjVDMyUyNUE2bGRlbmRlK2QuKzA1LjA2LnJ2dA",
"objectSet": [{
"id": [],
"isolated": [],
"hidden": [],
"explodeScale": 0,
"idType": "lmv"
}],
"viewport": {
"name": "",
"eye": ["-15.17842530349136", "-0.9048862425583284", "0.6506974303790392"],
"target": ["-22.06049144652811", "0.915848677106827", "-0.4205110420886964"],
"up": [-0.14385076361076257, 0.038057482024001874, 0.9888673247056924],
"worldUpVector": [0, 0, 1],
"pivotPoint": ["-22.510046835506888", "1.6223793651751013", "3.668585646439837"],
"distanceToOrbit": 7.198985875545766,
"aspectRatio": 1.491792224702381,
"projection": "orthographic",
"isOrthographic": true,
"orthographicHeight": 7.198985875545767
},
"renderOptions": {
"environment": "Boardwalk",
"ambientOcclusion": {
"enabled": true,
"radius": 13.123359580052492,
"intensity": 1
},
"toneMap": {
"method": 1,
"exposure": -7,
"lightMultiplier": -1e-20
},
"appearance": {
"ghostHidden": true,
"ambientShadow": true,
"antiAliasing": true,
"progressiveDisplay": true,
"swapBlackAndWhite": false,
"displayLines": true,
"displayPoints": true
}
},
"cutplanes": [],
"globalOffset": {
"x": -20.808594999999997,
"y": 6.686511499999999,
"z": 8.456207
}
},
"objectData": {
"guid": "6de5f80c-73da-30ae-b2d1-8a78f177c2a4",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6MDQyY2QwMmUtNzU0Yi00ZDY2LTgyYTMtNjBmYjFlOWVjMjcxL2U5ODAxZTA4LTUwZjQtNDc0ZS05ZWU4LTAxYWQ0ZGM0ODFiYl9WMV9Lb25nZXN0aWVuKzMwKy0rVGlsYnlnbmluZystK0clMjVDMyUyNUE2bGRlbmRlK2QuKzA1LjA2LnJ2dA",
"viewableId": "aaff5911-e8b1-4ae2-b41c-4284d0703eb4-00150218",
"viewName": "{3D}"
}
}
We then load the pushpin into the model again at a later point (when the user reopens the model), like this:
pushPinExtension.loadItems([pushPinItem]);
The result is that the pushpin is added in the model at the correct place, but the viewer state is incorrect. It seems like the viewer state for the pushpin is set to the viewer state of the model at the time when we load the pushpin - and not to the viewer state stored inside the pushpin.
Is this expected behaviour? - and if so, how do I use the viewer state from the pushpin instead?
why not explicitly load the viewer state stored in the pushpin separately after loading the pushpin:
pushPinExtension.loadItems([pushPinItem]);
viewer.restoreState(pushPinItem.viewerState)
EDIT:
Try restore the viewer state when an item is clicked - subscribe to the click event with:
viewer.restoreState(...)
//...
})

Backstopjs site loading issue not solved by delay: what is wrong?

When I try to run backstopjs on certain sites (they all must have some dynamic rendering thing in common, though I don't know what), the screenshots generated by backstopjs only include the first piece of content, centered in the screen. Here's the URL to a screenshot: https://user-images.githubusercontent.com/41495147/63806833-1612b680-c8e2-11e9-9932-680864b470b7.png
I've already tried setting the delay to 5 seconds. I've tried waiting until the footer class is available before screenshot. No dice. What is going on? Here's my config file:
"id": "backstop_default",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 480
},
{
"label": "tablet",
"width": 1024,
"height": 768
},
{
"label": "desktop",
"width": 1280,
"height": 1024
}
],
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "VMLYR Home",
"cookiePath": "backstop_data/engine_scripts/cookies.json",
"url": "https://www.vmlyr.com",
"referenceUrl": "",
"readyEvent": "",
"readySelector": ".region-footer",
"delay": 5000,
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": "",
"clickSelector": "",
"postInteractionWait": 0,
"selectors": [],
"selectorExpansion": true,
"expect": 0,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
}
],
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "backstop_data/engine_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"report": ["browser"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"]
},
"asyncCaptureLimit": 5,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}```

Amcharts does not show 2d Y axis (Json data)

I have the following Json data (extract) that I use to graph a dual Y axis chart with amchart:
[{"Day":"24-05 10H","Production":"0.82431267","USD":"482.02837415988"},{"Day":"24-05 11H","Production":"0.83045272","USD":"485.61885435808"},{"Day":"24-05 12H","Production":"0.83441691","USD":"487.93696995924"},{"Day":"24-05 01H","Production":"0.84323421","USD":"493.09300957644"},{"Day":"24-05 02H","Production":"0.85096095","USD":"497.61132896580006"},{"Day":"24-05 03H","Production":"0.85694953","USD":"501.11323496092"},{"Day":"24-05 04H","Production":"0.868104","USD":"507.635967456"},{"Day":"24-05 06H","Production":"0.8802085","USD":"519.796567173"},{"Day":"24-05 07H","Production":"0.8913847","USD":"532.3438566870001"},{"Day":"24-05 08H","Production":"0.89426695","USD":"530.7322322868499"},{"Day":"24-05 09H","Production":"0.89904346","USD":"531.08385173466"},{"Day":"24-05 10H","Production":"0.90740126","USD":"535.88759172324"},{"Day":"24-05 11H","Production":"0.91944257","USD":"554.8872687652799"},{"Day":"25-05 12H","Production":"0.92783829","USD":"554.54203862259"},{"Day":"25-05 02H","Production":"0.94182047","USD":"565.81654194143"},{"Day":"25-05 03H","Production":"0.94743531","USD":"574.52571941931"},{"Day":"25-05 04H","Production":"0.95331299","USD":"579.83927978564"},{"Day":"25-05 05H","Production":"0.9563386","USD":"580.4497132700001"},{"Day":"25-05 06H","Production":"0.96906754","USD":"594.5520078162"},{"Day":"25-05 07H","Production":"0.97823946","USD":"580.6878346533"},{"Day":"25-05 08H","Production":"0.97823946","USD":"580.6878346533"},{"Day":"25-05 09H","Production":"0.99806768","USD":"595.88932187024"},{"Day":"25-05 10H","Production":"0.00706363","USD":"4.21520001161"},{"Day":"25-05 11H","Production":"0.01715723","USD":"10.19647316008"},{"Day":"25-05 12H","Production":"0.02629501","USD":"15.77321951856"},{"Day":"25-05 01H","Production":"0.04011605","USD":"24.3299831645"}
And the following code used to graph:
<script>
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"dataLoader": {
"url": "http://x.x.x.x/json.php", "format": "json"
},
"valueAxes": [{
"id": "v1",
"startDuration": 1,
"axisColor": "#FF6600",
"axisThickness": 5,
"gridAlpha": 0.1,
"axisAlpha": 1
}, {
"id": "v2",
"axisColor": "#FCD202",
"axisThickness": 5,
"gridAlpha": 0,
"axisAlpha": 1,
"position": "right",
"synchronizeWith": "v1",
"synchronizationMultiplier": 5
}],
"graphs": [{
"valueAxis": "v1",
"type": "column",
"fillColorsField": "#B0DE09",
"balloonText": "[[category]]: <b>[[value]]</b>",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"title": "Production Crypto",
"valueField": "Production"
}, {
"valueAxis": "v2",
"type": "smoothedLine",
"lineColor": "#364cf2",
"lineThickness": 3,
"bulletBorderThickness": 1,
"hideBulletsCount": 30,
"title": "Production USD",
"valueField": "USD",
"fillAlphas": 0
}],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "Day",
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start",
"tickLength": 20
}
});
</script>
This is the screenshot of the graph I get:
Where the blue line for the USD series clearly does not render properly.
I have been able to get a dual Y axis graph showing properly (http://jsfiddle.net/spjem6b8/) with random generated data, so I guess this is the json part that generates this issue.
What am I doing wrong here?
Thanks
Your synchronizationMultiplier isn't high enough to make the second Y axis large enough to encapsulate your USD values in your dataset. In your current setup, your second Y axis values range from 0-6, but your USD values range from 4-600. Increase your syncrhonizationMultiplier to 600 in this case and it will work.
"valueAxes": [{
"id": "v1",
"startDuration": 1,
"axisColor": "#FF6600",
"axisThickness": 5,
"gridAlpha": 0.1,
"axisAlpha": 1
}, {
"id": "v2",
"axisColor": "#FCD202",
"axisThickness": 5,
"gridAlpha": 0,
"axisAlpha": 1,
"position": "right",
"synchronizeWith": "v1",
"synchronizationMultiplier": 600
}],
There's also an unsupported beta property called synchronizeGrid that can sometimes do this for your automatically, but it's not guaranteed to work with all value axis setting combinations so your mileage may vary. This is set at the top of the chart config:
AmCharts.makeChart("chartdiv", {
// ...
synchronizeGrid: true, //no need for synchronizeWith/Multiplier in the value axis
// ...
});
Here's an updated fiddle with the updated multiplier: http://jsfiddle.net/spjem6b8/1/

Json.NET (Newtonsoft.Json) - Two 'properties' with same name?

I'm coding in C# for the .NET Framework 3.5.
I am trying to parse some Json to a JObject.
The Json is as follows:
{
"TBox": {
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2 },
"TBox": {
"Name": "MedBox",
"Length": 5,
"Width": 10,
"Height": 10 },
"TBox": {
"Name": "LargeBox",
"Length": 20,
"Width": 20,
"Height": 10 }
}
When I try to parse this Json to a JObject, the JObject only knows about LargeBox. The information for SmallBox and MedBox is lost. Obviously this is because it is interpreting "TBox" as a property, and that property is being overwritten.
I am receiving this Json from a service that's coded in Delphi. I'm trying to create a C# proxy for that service. On the Delphi-side of things, the "TBox" is understood as the type of the object being returned. The inner properties ("Name", "Length", "Width", "Height") are then understood as regular properties.
I can serialize and deserialize a custom 'TBox' object that has Name, Length, Width, and Height properties. That's fine.
What I want to do is step through all the TBox sections in such a way as to extract the following three Json strings.
First:
{
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2 }
Second:
{
"Name": "MedBox"
"Length": 5,
"Width": 10,
"Height": 10 }
Third:
{
"Name": "LargeBox"
"Length": 20,
"Width": 20,
"Height": 10 }
Once I have these strings, I can serialize and deserialize to my heart's content.
I'm finding Newtonsoft.Json to be very good. I really don't want to go messing about with other frameworks if I can avoid it.
Any help would be greatly appreciated.
I have very limited input as to changes that can be made to the server.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
JsonTextReader jsonReader = new JsonTextReader(reader);
jsonReader.Read();
while(jsonReader.Read())
{
if(jsonReader.TokenType == JsonToken.StartObject)
{
JObject tbox = JObject.Load(jsonReader);
}
}
However, note that the RFC says, "The names within an object SHOULD be unique" so if you can, recommend the format be changed.
EDIT: Here's an alternate design that doesn't have duplicate keys:
[
{
"TBox": {
"Width": 1,
"Length": 1,
"Name": "SmallBox",
"Height": 2
}
},
{
"TBox": {
"Width": 10,
"Length": 5,
"Name": "MedBox",
"Height": 10
}
},
{
"TBox": {
"Width": 20,
"Length": 20,
"Name": "LargeBox",
"Height": 10
}
}
]
If I'm not mistaken, the correct answer to this is that your input is not actually JSON. So no, getting a JSON parser to parse it probably isn't going to work.
Maybe you don't have any control over the source of the input, so I'd use a Regex or something to pre-filter the string. Turn it into something like:
{"TBoxes":
[
{
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2
},
{
"Name": "MedBox",
"Length": 5,
"Width": 10,
"Height": 10
},
{
"Name": "LargeBox",
"Length": 20,
"Width": 20,
"Height": 10
}
]
}
And treat it like the array that it is.