Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - yolik

Pages: [1] 2 3 ... 10
1
Thanks a lot NevTD, it works perfectly, I was not accustomed to this part of the doc, indeed it contains valuable information!
Just for info in the code we can avoid a loop using SDGraph.getPropertyFromId() if we know the property id.

2
Substance DesignerSubstance Designer - Scripting - Get input parameter group?
 on: November 08, 2019, 11:43:50 am 
I'd need to get the group name an input parameter belongs to (for instance in Tile Sampler, size related parameters are into a Size group etc.), but I don't find this in the SD API documentation. Anyone knows a way to get this? Thanks.

3
@NevTD Nice find! However these options are not in the SD API at this time (2019.2.2)

4
Can you check if this points you in the right direction?
https://forum.substance3d.com/index.php/topic,30680.msg117937.html#msg117937

Thanks but this is only getting inheritance properties which I am already doing. My point is to get the actual size value.

5
Hi,

I have a node whose Output Size ("$outputsize") is relative to parent. This node is inside a graph which also is relative to parent (actual parent size is indicated in the graph toolbar). How can I get the actual parent size? There is no parenting link from an SDNode to its parent, neither there is in the SDProperty. Also, when on the top graph whose size is relative to the parent size indicated in the toolbar, how do we get this size? Thanks!

6
When you're modifying the default value via node.getReferencedResource().setPropertyValue(), correct?

Yes. Even if we cannot save it, that should not be allowed, we can enable hidden properties this way that should be read-only. I will submit a bug report.

7
Yes, your explanations make sense, I was just commenting on "In this case both "default" values and "actual" values are the same". Thanks again for your help!

I noticed we can also set values into the sbsar referenced graph and these are taken as default values (i.e. when using "Reset to default" menu on instance parameters, these show up). I am not sure why this is enabled as this is rather "dangerous", we are not supposed to modify the defaults of an sbsar which should be read-only I guess.

8
Quote
Indeed getting values from the node is working, but getting values from the graph being referenced by the node (node.getReferencedResource()) is returning the default values instead of the actual values
In this case both "default" values and "actual" values are the same.

Not sure what you mean by "the same" here, as in practice they are not the same. I.e. with the following scenario:
- drag&drop sbsar in current graph
- click on sbsar to display its properties, notice default value for a given integer input param is 1
- change this value to 5 manually

now, using the Python API:
- access the sbsar SDNode by parsing the current graph, get the property value for the integer we modified, we get 5.
- access the sbsar SDGraph from the node (being SDNode.getReferencedResrouce()), get the property value for the integer we modified, we get 1.



9
1) How is this set up? Is this sbsar parameter you're querying exposed to the main graph? Or is it simply showing you the values of another parameter that happens to have the same id as the sbsar parameter?

This is an sbsar dragged&dropped from the Library into the current graph.

2) To get the actual value from the sbsar, you'd need to query it from the node.

Thanks! Indeed getting values from the node is working, but getting values from the graph being referenced by the node (node.getReferencedResource()) is returning the default values instead of the actual values. Setting property values into the graph object changes its default values, whereas setting property values into the node changes its current values. So things are consistent, I just didn't know it worked like this :)




10
Hi, I am trying to retrieve current values of input parameters of an sbsar present into my current graph. It seems I am only getting the default values instead of the actual ones. I think this is a bug, can anyone please check/confirm? SD 2019.2.2

Code: [Select]
    @classmethod
    def logInputProperties(cls, graph):
        log("graph id=" + graph.getIdentifier())
        props = graph.getProperties(SDPropertyCategory.Input)
        psize = props.getSize()
        p = 0
        while p < psize:
            prop = props.getItem(p)
            propId = prop.getId()
            val = graph.getPropertyValue(prop)
            if isinstance(val, SDValueInt2):
                valInt2 = val.get()
                log(propId + " (int2): x=" + str(valInt2.x) + " y=" + str(valInt2.y))
            p += 1

11
Well the way you found looks logical and is doing exactly what I need so as far as I am concerned the solution is perfect! Thanks again.

12
Thanks a lot NevTD, it is working perfectly! I didn't realize the sbsar was considered as a package which needed to be loaded.

13
Hi, I am trying to create an sbsar node inside a graph using the Python API. I am not sure this is currently possible, I would appreciate any info about this. Currently here is what I am doing:

  • I have the sbsar manually imported as a resource inside the current package. By inspecting package content I can see the sbsar and its graphs are imported as SDResourceCustom, which is not a good sign for what follows as the doc defines custom resources as "A valid resource whose type is not natively supported"
  • I made code to access current graph and create a new instance inside it using SDGraph.newInstanceNode(sbsar) (sbsar being of type SDResourceCustom). As a result, I get an exception saying "not supported".

So it seems to me we cannot currently create sbsar instances in a graph, is this right?

14
I don't have access to the latest API currently, but have you looked into the new QT GUI related API features introduced in > 2019.1.0?

Yes I have been looking into the new Qt features but there doesn't seem to be an method to open a container in the UI currently.

Quote
Ah, I wasn't aware of this but I did look into it and it is possible, just not from the node object.
Although the comment created in this manner still belongs to the active graph, it adds an additional attribute creating a dependency to the node.

Ok! So indeed there seems to be a way to indirectly get the comment from a node, however this will be quite inefficient in terms of parsing. Thanks a lot, I will explore this option maybe using some caching mechanism.

Quote

* If you're wondering how I know this: The sbs file is pretty much an xml file; you can open it up in an editor and try to cross reference the compNode and GUIObjects.


Indeed, this is good to know, thanks!

15
Thanks for your answers!

Regarding "open a graph or function in the UI", there is apparently no such functionality currently. I meant to open a container in the UI in the same way you would do when double-clicking on a function in the Explorer view or a graph or using CTRL+E to enter a node.

Regarding comments, they can actually be associated to nodes, you can see this by creating a node, right-clicking on it to assign it a comment, then when you move the node in the view, the comment also moves with it. So there is a logical link between the two, however this link doesn't seem to be accessible in the API currently.


Pages: [1] 2 3 ... 10