"reload" button doe not work


I am not sure if it is just me, but the “reload” button doesn’t seem to work. Instead, I need to reselect the JSON file which I would like to reload.

Oh and speaking of JSON:
is there a list of possible arguments when using JSON to “spawn” Objects in the viewport?
In the example file, there is “P” and “scale”. I tried “rotate” as well (which didn’t work).

ah, yes, that sounds like a bug. Sorry for the confusion. I’ll take a look.

1 Like

And yes, that should be better documented, I’ll work on that.

The attributes you can currently use are:

  • P (or position): 3 float
  • scale: 3 float
  • pscale: 1 float, same as scale, but is more convenient if all you need is a uniform scale
  • N (or normal): 3 float, gives the direction.
  • up: 3 float, gives the up vector

So to orient your object, you would use N on its own, or both N and up.

So the following:

[{"P":[1,0,0], "pscale":1.2,"normal":[0,1,0],"up":[1,0,1]}]

gives this:

Let me know if that doesn’t help.

1 Like

Oh wow. Thank you for this example.

Seems to be a bit less intuitive than I hoped … :roll_eyes:

So if I would like to spawn vertices (e.g. as reference points for geometry) that I would like to rotate around a pivot point, I would need to choose a different workflow, right? Maybe I would need to create some kind of a hirarchy first in order to rotate the parent helper/dummy/object?

This is a quick example made in Blender:

As I understand of what you’d like to achieve, you can still use this same workflow.

But let me first break down how you could reproduce the screenshot you sent with the copy sop and instance sop.

With the copy sop, create a circle, set its angle, then create a normal (either with attribCreate, or with normals, or with an attribCopy, and set its value to be the same the position attribute).

And with the instance node, it’s similar:

(I can explain further the difference between instance and copy if you’d like - in short, use instance for large number of objects as its more performant)

Once you have that working with either of those 2 nodes, it may make more sense what attributes to give them. And you can always check those values in the spreadsheet.

And you can then use those values in a data node (assuming the goal is still to get that data from a database). For instance, by using the same values in P and N, like this:


This gives me this:

Happy to develop further if that’s still not flexible enough

1 Like

I’ll also add other examples about instancing/copying objects in the examples page, that’ll help try things out quicker

1 Like

I’ve added the screenshots from my previous message as live examples, if that helps:

And here is also another way to use the sop/data node (which works similarly to sop/dataUrl).

Instead of specifying the attributes of each point to use in the sop/copy, you can give higher level properties. In this case, the data is used by the circle node to drive its radius/segments/angle, and only then it is given to the copy node. So you could really drive any other node like this.

1 Like

WOW. This is impressive! :astonished:

Your examples are VERY helpful! Thank you for sharing them!

Basically, I’m looking for a way to distribute data points from JSON in the viewport along a circular shape (or thinking 3D - on the surface of a sphere). But the data points are weighted and not evenly distributed. E.g. there are more points on one side of the circle (or at one of the poles of a sphere). Each Data point has its individual position.

However - I am not sure how I am going to define each data position within my JSON file. Sure - I could define a xyz value for each point. But then again it would be hard to recreate a circular (or spherical) shape. So I thought, it might be possible to define a vertex point with an offset (-> shifting it away from its origin/pivot point) and each datapoint then comes with only one value: the Y-Rotation (or Y and X rotation for the sphere scenario).

Now that I think of it - maybe I could make use of the PolarTransform node. This way I could probably use Lat/Long … :thinking:

I’m still just scratching the surface. But it’s really starting to get interesting. :smiley:

1 Like

Cool, glad that’s helpful. And it’s definitely fun when there are many options to explore like that.

Here are other nodes that may be useful (I’ll make examples of those later in the week):

  • the scatter sop: it scatters points on a surface. And you can use an attribute on that surface as a weight, so that the polygons with more weight will have more points.
  • the attribTransfer: it can help you set that weight attribute
  • the copy sop can also be used without a second input, and just duplicate the 1st a number of times, using the param ‘count’. Then you can set a translate/rotation/scale on the copy node, and each duplicate object will accumulate that transform.

Sounds good. :slight_smile:

I have another question concerning JSON Input:

As far as I understand it, it is only possible to use ONE argument for all points equally, right?
Or would it be possible to dynamically use the index number of the JSON data instead of a ‘0’ at this point? So each data point could use its own rotation.

@MDH sorry, I only see your message now.
I should be able to give suggestions later today or tomorrow.

1 Like

@MDH I’ve fixed the reload bug. And I’ve actually gone one step further (something I’ve had in mind for a long long time), which is to have the editor automatically detect when a local assets has been changed, and to automatically reload the relevant parameters when needed.

You can see it working on this page with json files: https://polygonjs.com/docs/editor/assets

I still have to test to see that it also works for models and textures. And while I believe this is convenient in most cases, there may be cases where you’d rather click on a button and see the change happen. So I’ll have a think if this could be toggled on/off from the File->Preferences.

But curious to see if that works for you. It’s available on version 1.2.51.

1 Like

Hello Gui,

a live update sounds great. :astonished: :+1:

However, I currently have the problem that the viewport does not update reliably at all. E.g. I see the points in the viewport when I display the data node. But as soon as I click on the switch node below, the points disappear (mostly - but not always).


And if they are actually displayed on the switch node, they may disappear again in the node below.
Currently it is hardly possible to work, because very often things are not displayed, or already deleted nodes still show the old result in the viewport.
This seems to be some caching problem I guess. Browser reboot and restart of polygonjs via terminal didn’t help so far (recooking and browser refresh didn’t help either).

I noticed this in version 1.2.33-4, but also in the current 1.2.51-1.

Do you have any tips for me on how I could overcome that problem?

Thank you for letting me know @MDH, I’d have to fix this asap, this is indeed unpractical to use like this.

I’m thinking this could happen when a specific node crashes (even though there are several protections to prevent that from blocking the whole scene). Or maybe it’s something else.

Does that happen on any of the example scenes? If not, could you maybe send me a zip of your project, and write a step by step on how to reproduce the problem? Or you could also create a scene in the online editor and send me the link.

Another thing you could try is see if there is any error message in the developer console. Assuming you are on chrome, You can open it with the 3 dots in the top right → More Tools → Developer Tools, then ‘console’.

As soon I can reproduce it here, I’ll be able to fix it and add it to the automated test suite, so that it doesn’t happen again.

yes, I tried it in Chrome and in Opera. In both cases I had these problems.
Here is a screenshot from the Console in Chrome:

And this is the project as a zip file:

I hope it helps to find the issue. :slight_smile:

1 Like

Thanks a lot @MDH.

And it looks like the problem is that the node with type fileJSON (so in your scene that’s the 2 nodes /geo1/fileJSON1 and /geo1/fileJSON2 fail silently and sort of block the scene). So I’ll work and make sure they report any error correctly.

Also, when importing json data from a file (the same type of data that the sop/data node accepts), you should use the sop/dataUrl, not the fileJSON. I realise this is quite confusing, so I’ll also make any error message more helpful.

the fileJSON is really to import a full threejs scene which would have been saved as a json. And since both dataUrl and fileJSON load .json format, there is an overlap, but the content of the json is actually much different.

So in short, delete the fileJSON, save your scene, and try again with a dataUrl, and you should be good. At least I could manipulate the scene just fine after that change.

1 Like

Oh wow. That’s good to know.
I replaced the fileJSON with a dataUrl. Now everything works as expected. :smiley:

Thanks again for your help!

1 Like