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 - jmkintela

Pages: [1]
1
Substance DesignerSubstance Designer - Scripting - Re: Color Mask
 on: June 09, 2021, 06:14:06 pm 
I think this should be a common workflow..
to set a random color for each submesh, and then use this same color to create a color mask per color should be a one button thing ,Withouth any use or installing of any external tool by part of a artist oriented user.

For udim workflow I don't know a better way than working with color mask and blend nodes.
 I'm working on doing this for myself,  is very painfull to set up by hand each time, also the submesh coloring interface is very small, is very slow to be scrolling across each group and check  if All the colors are different, and after that to be creating each color mask and sampling the colors, and then connecting blend nodes.. very very painfull and totally scriptable.

Can this be added as a feature request or at least submit the hability of the python sdk to write Color tables randomly by picking equidistante points on hues scale or something similar. ?

I'm working on recursion trees to generate this structures and generate the tool by requesting the color table by the part of the user, I'll be posting on the show case when it's done... but the better ways is just to write the color tables directly on the baking map proprierties, and to include all the baking setups on the python sdk would be even better, so I can match the same data on any further use along the material construction.

2

Ok now it's Working!
Code: [Select]
import sd
from PySide2 import QtGui
from sd.api.sduimgr import SDUIMgr
from sd.api.sdproperty import SDPropertyCategory
from sd.api.sdapplication import SDApplicationPath

def Add_Node(name,pos):
 
        # Get app and UI manager.
        ctx = sd.getContext()
        app = ctx.getSDApplication()
        ui_manager = app.getQtForPythonUIMgr()
        # Get the comp graph.
        sd_graph = ui_manager.getCurrentGraph()
        # Create a node.
        node_def_id = 'sbs::compositing::{definition}'.format(definition=name)
        sd_node = sd_graph.newNode(node_def_id)
        sd_node.setPosition( sd.api.sdbasetypes.float2( pos[0],pos[1]))
       
        return sd_node
# Run


def NodeProps(node):
    nodePropsA = node.getProperties(SDPropertyCategory.Output)
    for i in range(len(nodePropsA)):
    print(nodePropsA[i].getId())
    print(nodePropsA[i].getType())
   
    nodePropsB = node.getProperties(SDPropertyCategory.Input)
    for i in range(len(nodePropsB)):
    print(nodePropsB[i].getId())
    print(nodePropsB[i].getType())


Pos = [0,0]
PosOffset = [500, 50]
blends = []
Name = 'blend'

def Select():
    ctx = sd.getContext()
    app = ctx.getSDApplication()
    uiMgr = app.getQtForPythonUIMgr()
    selection = uiMgr.getCurrentGraphSelection()
Select()
for e,node in enumerate(selection):
   
    NodePos = node.getPosition()
    print(NodePos)
    Pos[0] = NodePos.x + PosOffset[0]
    Pos[1] = NodePos.y + PosOffset[1]
    print(Pos)
    NodeBlend = Add_Node(Name,Pos)
    blends.append(NodeBlend)
    node.newPropertyConnectionFromId('output',  NodeBlend  ,'opacity')   

3
Thanks!, Ok I see!

4
Substance DesignerSubstance Designer - Scripting - Node Selection order
 on: June 07, 2021, 11:06:11 pm 
I'm doing a loop to connect a bunch of color masks to blend nodes via python loop , but the connection occurs randomly and nost in order as one would expect... what's wrong?

this is the code
Code: [Select]
import sd
from PySide2 import QtGui
from sd.api.sduimgr import SDUIMgr
from sd.api.sdproperty import SDPropertyCategory
from sd.api.sdapplication import SDApplicationPath

class CompNodeCreator(object):
    def __init__(self):
        # Get app and UI manager.
        ctx = sd.getContext()
        app = ctx.getSDApplication()
        self.ui_manager = app.getQtForPythonUIMgr()
       
 
   
    def add_node(self, name, pos):
     
        # Get the comp graph.
        sd_graph = self.ui_manager.getCurrentGraph()
       
        # Create a node.
        node_def_id = 'sbs::compositing::{definition}'.format(definition=name)
        sd_node = sd_graph.newNode(node_def_id)
        sd_node.setPosition( sd.api.sdbasetypes.float2(pos[0],pos[1]))
       
        return sd_node

# Run


def NodeProps(node):
    nodePropsA = node.getProperties(SDPropertyCategory.Output)
    for i in range(len(nodePropsA)):
    print(nodePropsA[i].getId())
    print(nodePropsA[i].getType())
   
    nodePropsB = node.getProperties(SDPropertyCategory.Input)
    for i in range(len(nodePropsB)):
    print(nodePropsB[i].getId())
    print(nodePropsB[i].getType())

selection = uiMgr.getCurrentGraphSelection()
i = 300
i2 = 0
pos = [0,0]
n = {}

for e,node in enumerate(selection):
    print(pos)
    print(str(e))
    name = 'blend'
    blend = node_creator.add_node(name,pos)
    node.newPropertyConnectionFromId('output',  blend  ,'opacity')   
    pos[0] += i2
    pos[1] += i

5
Thanks, I'll check those  ;D !

6
Substance DesignerSubstance Designer - Scripting - Re: Color Mask
 on: June 07, 2021, 04:19:19 pm 
ok thanks!  :)

7
Substance DesignerSubstance Designer - Scripting - Re: Color Mask
 on: June 07, 2021, 05:32:45 am 
Please some help!, I just want to know how to set the submesh colors and hit the bake map!, the rest I can figure out later.

8
Ok get it!, it was a problem of naming the input output correctly  ;D ::)

Code: [Select]
import sd
from PySide2 import QtGui
from sd.api.sduimgr import SDUIMgr
from sd.api.sdproperty import SDPropertyCategory
from sd.api.sdapplication import SDApplicationPath

class CompNodeCreator(object):
    def __init__(self):
        # Get app and UI manager.
        ctx = sd.getContext()
        app = ctx.getSDApplication()
        self.ui_manager = app.getQtForPythonUIMgr()
       
 
   
    def add_node(self, name, pos):
     
        # Get the comp graph.
        sd_graph = self.ui_manager.getCurrentGraph()
       
        # Create a node.
        node_def_id = 'sbs::compositing::{definition}'.format(definition=name)
        sd_node = sd_graph.newNode(node_def_id)
        sd_node.setPosition( sd.api.sdbasetypes.float2(pos[0],pos[1]))
       
        return sd_node

# Run

pos = [200,0]
pos2 = [400,0]
name = 'blend'
node_creator = CompNodeCreator()
nodeA = node_creator.add_node(name,pos)
nodeB = node_creator.add_node(name,pos2)

definition = nodeA.getDefinition()
nodeId = nodeA.getIdentifier()
#get Output names
nodePropsA = nodeA.getProperties(SDPropertyCategory.Output)
for i in range(len(nodePropsA)):
print(nodePropsA[i].getId())
print(nodePropsA[i].getType())
#get input names
nodePropsB = nodeB.getProperties(SDPropertyCategory.Input)
for i in range(len(nodePropsB)):
print(nodePropsB[i].getId())
print(nodePropsB[i].getType())

#Make Connection
nodeA.newPropertyConnectionFromId('unique_filter_output', nodeB ,'source')


9
Substance DesignerSubstance Designer - Scripting - Create a connection
 on: June 06, 2021, 05:27:50 am 
Hi, how Do I create a connection between two nodes?? via python of course

I have this code working to create the nodes :

Code: [Select]
from PySide2 import QtGui
from sd.api.sduimgr import SDUIMgr
import sd

class CompNodeCreator(object):
    def __init__(self):
        # Get app and UI manager.
        ctx = sd.getContext()
        app = ctx.getSDApplication()
        self.ui_manager = app.getQtForPythonUIMgr()
       
 
   
    def add_node(self, name, pos):
     
        # Get the comp graph.
        sd_graph = self.ui_manager.getCurrentGraph()
       
        # Create a node.
        node_def_id = 'sbs::compositing::{definition}'.format(definition=name)
        sd_node = sd_graph.newNode(node_def_id)
        sd_node.setPosition( sd.api.sdbasetypes.float2(pos[0],pos[1]))
       
        return sd_node

# Run

pos = [200,0]
pos2 = [400,0]
name = 'blend'
node_creator = CompNodeCreator()
node = node_creator.add_node(name,pos)
node2 = node_creator.add_node(name,pos2)

10
Substance DesignerSubstance Designer - Scripting - Color Mask
 on: June 05, 2021, 02:55:22 pm 
I want to bake a color map by creating a random color for each submesh group,
and use this colors to create one Color mask per Color,
 So I need to create this colors and store them on a list to loop them over later,
I attach some Pseudo Code So you can get what I want to do.
How Can I do this via python?

11
More than a question is an observation.
I've been trying to use the python api and the lack of examples on the api docs is  driving me mad to the point of quit learning it.
Please create some real use examples , or a Git project with some real code.
I open each of the post on this section to look for example code, but found very little.
I'm the only one with this problem?

12
Hi
I have a substance designer .sbsar material working with udims,
I want to import it with labs substance material on houdini and write all udims textures per frame on COPS network,
so I can animate it's values over time..
but I can't get to export all udims on houdini, only the first show up..
it's some kind of export thing I have to do on SD ?

I'm asking this question on houdini forum also: https://www.sidefx.com/forum/topic/79191/


Pages: [1]