Forum

  • Index
  •  » Scripting
  •  » Refresh in the current rendergraph with python

#1 2017-06-14 22:53:28

xiaoshibo
Member

Refresh in the current rendergraph with python

Hi,

Does anyone know how to force a refresh in the current rendergraph with python ?

Thanks in advance,


Lighting Artist

Offline

 

#2 2017-06-15 11:28:44

Ben
Guerilla dev, the guy to hug

Re: Refresh in the current rendergraph with python

Hi Shibo,

What do you mean by force a refresh? Can you tell me what you want to achieve?

Cheers,
Ben


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#3 2017-06-15 20:26:46

xiaoshibo
Member

Re: Refresh in the current rendergraph with python

Hi Ben,

I used nodes.move(parent) and mod.movenode(nodes, parent) to place some rendergraph nodes into a macro, they are all in the same rendergraph. What happened was that icons don't disappear after executing the script but if I enter the macro then leave the macro,those icons disappear. I think its probably a refresh issue.

also, I have another question, how to execute --command.executebyshortname("Arrange Graph") in a macro without entering it ? maybe something like --command.executebyshortname("Arrange Graph", parent)

Thank you !


Lighting Artist

Offline

 

#4 2017-06-16 10:10:17

Narann
Member

Re: Refresh in the current rendergraph with python

Hi Shibo!

I suspect you don't use guerilla.Modifier():

Code:

with guerilla.Modifier() as mod:
    my_node.Pos.set([100, 50])

should work. smile

Offline

 

#5 2017-06-16 16:04:30

xiaoshibo
Member

Re: Refresh in the current rendergraph with python

hi Narann,

I did use:
with guerilla.Modifier() as mod:
    mod.movenode('some nodes', parent)

it's about moving some rendergraph nodes into another rendergraph node(macro), not changing the position[x,y] in a rendergraph.

for example, if you have a [Path] and a [Macro] in the same rendergraph, try to place the Path into Macro either with 'guerilla.Modifier.movenode' or 'guerilla.Node.move' as you wish, what happened on me is the Path node icon rest there after being placed into the Macro. To check if it's already placed in to Macro.

for i in macro.children():
    print i.name

# Path
# Output
# Output1

Hopefully I have explained clearly.

Best smile

Last edited by xiaoshibo (2017-06-16 16:06:53)


Lighting Artist

Offline

 

#6 2017-06-16 16:54:08

Ben
Guerilla dev, the guy to hug

Re: Refresh in the current rendergraph with python

Hi Shibo,

Unfortunately, you can't use movenodes to move RenderGraph nodes.
Quite a lot of RenderGraph invalidation will depend on the nodes being not moved -- there are a lot of plugs from the node which are supposed to spread invalidation to their parent node, but these connections are not following when moving the node. So, unfortunately, this is not so easy.

Actually, you can't move a RenderGraph node in the node list, for this very reason. Sorry about that.

Ben


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#7 2017-06-16 17:07:17

xiaoshibo
Member

Re: Refresh in the current rendergraph with python

HI Ben,

Thank you very much for your explanation. In fact,  I have already found an alternative way to do it, but it's so good to understand how Guerilla is thinking.

I made the 'move' with help of 'getstringcopy' and 'pastestringcopy' as below:

        for i in sel:
            copy = i.getstringcopy()
            macro.pastestringcopy(copy)
            i.delete()

I have no more the issue. so those Paths nodes will be deleted from current rendergraph after pasting into Macro.


Lighting Artist

Offline

 

#8 2017-06-16 18:40:26

Ben
Guerilla dev, the guy to hug

Re: Refresh in the current rendergraph with python

Yes, this is the simplest way to go.
Not super elegant, but this does the work ...


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 
  • Index
  •  » Scripting
  •  » Refresh in the current rendergraph with python

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB