OTL/ brush tool
13781 19 3- laiwayne
- Member
- 58 posts
- Joined: Sept. 2009
- Offline
I am trying to create an otl which can paint colors on a geometry(some thing like paint sop), but I found that the brush tool handle only can be accessed when the paint sop node is selected. Is there a way that I can use the brush tool/ handle when I select my OTL? or I can tweak the paint sop node and save my tweaked version paint SOP as a sop OTL?
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Online
Take a look at this thread: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=18863 [sidefx.com]
Graham Thompson, Technical Artist @ Rockstar Games
- laiwayne
- Member
- 58 posts
- Joined: Sept. 2009
- Offline
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Online
- laiwayne
- Member
- 58 posts
- Joined: Sept. 2009
- Offline
- kuba
- Member
- 345 posts
- Joined:
- Offline
laiwayne
Is there anyway that I can keep my OTL as current node and I also can get the brush tool and paint?
Well, you can mimic this behaviour, at least to certain extents. What I often do is to use a pin method to lock down the parameters window the paint operation was triggered from. The downside of this approach is to unpin the window manually each time once you are done.
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Hey guys, just noticed something that may be of use here… inside of your DA, you can actually right click on your standard paint nodes and “Edit Parameter Interface”. This is not modifying the paint DA itself, is just adding parameters to that instance.
What this means is that, theoretically, you can add a “Done Painting” button with a bit of python to push the user out of the paint context and into the main DA. Also, you may be able to add additional parameters such as sliders, etc, that are connected to your top level parameters that are associated to the paint process (i.e. if you have a blend weight associated to your painting).
I am going to try this later and let you know if it works, but I do not see why it would not
What this means is that, theoretically, you can add a “Done Painting” button with a bit of python to push the user out of the paint context and into the main DA. Also, you may be able to add additional parameters such as sliders, etc, that are connected to your top level parameters that are associated to the paint process (i.e. if you have a blend weight associated to your painting).
I am going to try this later and let you know if it works, but I do not see why it would not
-G
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
aaaand good news! It looks like this works in lieu of being able to “promote” your brush manipulator, you can actually modify a paint SOP interface to your liking, and have a paint button that dives in, and a done button that gets out
Now, if you go to a type properties of a node, it does allow you to change the name of the node and even the otl that it saves to. Perhaps this could be a way to have your “own” version of the paint SOP?
Now, if you go to a type properties of a node, it does allow you to change the name of the node and even the otl that it saves to. Perhaps this could be a way to have your “own” version of the paint SOP?
-G
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- sohamramteke
- Member
- 4 posts
- Joined: June 2011
- Offline
grayOlorin
Hey guys, just noticed something that may be of use here… inside of your DA, you can actually right click on your standard paint nodes and “Edit Parameter Interface”. This is not modifying the paint DA itself, is just adding parameters to that instance.
What this means is that, theoretically, you can add a “Done Painting” button with a bit of python to push the user out of the paint context and into the main DA. Also, you may be able to add additional parameters such as sliders, etc, that are connected to your top level parameters that are associated to the paint process (i.e. if you have a blend weight associated to your painting).
I am going to try this later and let you know if it works, but I do not see why it would not
Hi Mate,
Could you please post what exactly did you add for the ‘Done Painting’ part in python. Or if you could attach the example file.
I tried to create the button and used callback to go back to the DA level but it din't work. Got ‘NoneType’ has no attribute… error. Obviously i am doing something wrong here.
Would really appreciate your help on this.
Many Thanks
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
I am not by my computer now, But try this. The issue may be because your callback is trying to point to an hdamodule in the wrong node (I.e the paint node instead of the parent DA). Try this in your callback:
Hou.node(“..”).hdaModule.yourpaintfunction(“..”)
Where yourpaintfunction is whatever you called your function to enter the paint node, and “..” is the relative path to your parent node. You do not want to use pwd() in tHis case since the function is part of the parent da hdamodule
Hou.node(“..”).hdaModule.yourpaintfunction(“..”)
Where yourpaintfunction is whatever you called your function to enter the paint node, and “..” is the relative path to your parent node. You do not want to use pwd() in tHis case since the function is part of the parent da hdamodule
-G
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- tamte
- Member
- 8555 posts
- Joined: July 2007
- Offline
be careful with this approach since
making node editable breaks updating of your HDA for that node
if that node is just paint SOP and you want to tweak it's parameters or painting for each instance of your HDA anyway, it's not a big deal
but
if you have created a few parameters on paint sop and save your HDA, that parameters will not be on paint SOP of all existing instances of your HDA since they are editable
let's say you don't have any instances and make your parameters and button and callback, when you are done you start using your HDA and all is working
then after using it several times
if you need to update something on the paint sop (add new parameter, change parameter reference on existing parameters, or change that callback), then the changes again will not propagate to existing instances of our HDA
so be careful when using editable nodes, it's double–edged sword
making node editable breaks updating of your HDA for that node
if that node is just paint SOP and you want to tweak it's parameters or painting for each instance of your HDA anyway, it's not a big deal
but
if you have created a few parameters on paint sop and save your HDA, that parameters will not be on paint SOP of all existing instances of your HDA since they are editable
let's say you don't have any instances and make your parameters and button and callback, when you are done you start using your HDA and all is working
then after using it several times
if you need to update something on the paint sop (add new parameter, change parameter reference on existing parameters, or change that callback), then the changes again will not propagate to existing instances of our HDA
so be careful when using editable nodes, it's double–edged sword
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- sohamramteke
- Member
- 4 posts
- Joined: June 2011
- Offline
Hi guys,
Thanks for replying.
FYI, I needed to paint multiple geometries(say ball and box) so i created individual ‘Paint’ buttons for them and to paint them i am using a ‘groupPaint’ node instead of ‘paint’ since that way it identifies which group of geometry to paint.
Now, in the Paint Ball button i am using
to dive in to the DA and into the groupPaint node and it does its job.
Then, for the Done Painting button i am using
and defined paintBall in Scripts PythonModule as
[ import toolutils
def paintBall(scriptargs):
sopnode = scriptargs
viewer = toolutils.sceneViewer()
paint = sopnode.node(“paintGeo”)
paint.setCurrent(True, True)
viewer.enterCurrentNodeState() ]
where “painGeo” is the name of the DA.
And it gives this error:
[ Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
AttributeError: ‘function’ object has no attribute ‘paintBall’ ]
Thanks for replying.
FYI, I needed to paint multiple geometries(say ball and box) so i created individual ‘Paint’ buttons for them and to paint them i am using a ‘groupPaint’ node instead of ‘paint’ since that way it identifies which group of geometry to paint.
Now, in the Paint Ball button i am using
to dive in to the DA and into the groupPaint node and it does its job.
Then, for the Done Painting button i am using
and defined paintBall in Scripts PythonModule as
[ import toolutils
def paintBall(scriptargs):
sopnode = scriptargs
viewer = toolutils.sceneViewer()
paint = sopnode.node(“paintGeo”)
paint.setCurrent(True, True)
viewer.enterCurrentNodeState() ]
where “painGeo” is the name of the DA.
And it gives this error:
[ Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
AttributeError: ‘function’ object has no attribute ‘paintBall’ ]
- sohamramteke
- Member
- 4 posts
- Joined: June 2011
- Offline
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Online
The error is a result of your attempt to access the Python Module incorrectly in your callback script. You have left off the parentheses () after hdaModule.
hou.node(“..”).hdaModule().paintBall(“..”)
Also, looking at your code, once the function call goes through it will error out again because your function is expecting a dictionary and you are passing it a string.
I would suggest a simple one line callback that just returns you up one level.
kwargs.parent().setCurrent(True, True)
This button will just set the current node to the parent asset and you'll be jumped back out.
hou.node(“..”).hdaModule().paintBall(“..”)
Also, looking at your code, once the function call goes through it will error out again because your function is expecting a dictionary and you are passing it a string.
I would suggest a simple one line callback that just returns you up one level.
kwargs.parent().setCurrent(True, True)
This button will just set the current node to the parent asset and you'll be jumped back out.
Graham Thompson, Technical Artist @ Rockstar Games
- sohamramteke
- Member
- 4 posts
- Joined: June 2011
- Offline
Hi Graham,
Thank you for explaining where i was going wrong and for your suggestion, it worked perfectly. I was looking for something exactly like that.
I further had a question, as you must have noticed in the network, since multiple geometries are being painted on the same grid and the output is being merged at the end, some of the geometries are bound to overlap, is there a way to avoid that..?
Your help is much appreciated
Thank you for explaining where i was going wrong and for your suggestion, it worked perfectly. I was looking for something exactly like that.
I further had a question, as you must have noticed in the network, since multiple geometries are being painted on the same grid and the output is being merged at the end, some of the geometries are bound to overlap, is there a way to avoid that..?
Your help is much appreciated
- tamte
- Member
- 8555 posts
- Joined: July 2007
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- Nikitha_Ann_George
- Member
- 8 posts
- Joined: Nov. 2015
- Offline
@sohamramteke, @graham
I am unable to understand where the script, kwargs.parent().setCurrent(True, True) should be entered.
Presently I am using the scene from https://www.sidefx.com/forum/topic/18863/, [www.sidefx.com]
and within the paint SOP inside Painter I have added new button Finish painting and used the above script in the Call Back. Please can you tell me where I am wrong?
Thanks in advance,
Nikitha
I am unable to understand where the script, kwargs.parent().setCurrent(True, True) should be entered.
Presently I am using the scene from https://www.sidefx.com/forum/topic/18863/, [www.sidefx.com]
and within the paint SOP inside Painter I have added new button Finish painting and used the above script in the Call Back. Please can you tell me where I am wrong?
Thanks in advance,
Nikitha
Edited by Nikitha_Ann_George - July 27, 2018 04:30:43
-
- Quick Links