pedohorse / hpaste Goto Github PK
View Code? Open in Web Editor NEWsimple plain text snippet exchange for Houdini
License: GNU Lesser General Public License v3.0
simple plain text snippet exchange for Houdini
License: GNU Lesser General Public License v3.0
As a user who is not using Shelf or strive to minimize it usage as much as possible since it uses so much space I hide it in 99% of time. So I am trying to add Submenu in the Edit menu to get access to main commands instead of Shelf.
Unfortunately currently the scripts are working only from Shelf.
It would be nice to make it possible to invoke scripts from menu as well.
Currently I am getting this error when trying to invoke Paste or Paste Web commands from the menu.
I am using this code to generate Submenu file โ MainMenuCommon.xml
<?xml version="1.0" encoding="UTF-8"?>
<mainMenu>
<menuBar>
<subMenu id="edit_menu">
<subMenu id="hpaste_menu">
<label>HPaste</label>
<insertAfter>h.paste</insertAfter>
<scriptItem id="hpaste_copy">
<label>Copy</label>
<scriptCode>
<![CDATA[
try:
from PySide2.QtWidgets import QApplication
except:
from PySide.QtGui import QApplication
import hpaste
def do():
try:
nodes=hou.selectedItems()
except:
nodes=hou.selectedNodes()
if len(nodes) == 0:
hou.ui.displayMessage("No nodes are selected!",severity=hou.severityType.Error)
return
try:
s=hpaste.nodesToString(nodes)
except RuntimeError as e:
hou.ui.displayMessage("Error: %s"%str(e),severity=hou.severityType.Error)
return
except RuntimeWarning as e:
hou.ui.displayMessage("Warning: %s"%str(e),severity=hou.severityType.Warning)
except Exception as e:
hou.ui.displayMessage("Internal Error: %s"%str(e),severity=hou.severityType.Error)
return
if hou.applicationVersion()[0] > 15:
hou.ui.copyTextToClipboard(s)
else:
qapp = QApplication.instance()
qapp.clipboard().setText(s)
do()
]]>
</scriptCode>
</scriptItem>
<scriptItem id="hpaste_paste">
<label>Paste</label>
<scriptCode>
<![CDATA[
try:
from PySide2.QtWidgets import QApplication
except:
from PySide.QtGui import QApplication
import hpaste
import hpaste.hpasteoptions as opt
def do(pane):
if hou.applicationVersion()[0] > 15:
s = hou.ui.getTextFromClipboard()
else:
qapp = QApplication.instance()
s = qapp.clipboard().text()
geonode = None
for _ in range(2):
try:
hpaste.stringToNodes(s, ne=pane, hou_parent=geonode)
except hpaste.InvalidContextError as e:
nec, snc = e.contexts()
if snc == 'Sop' and nec == 'Object':
if hou.ui.displayMessage("Error: %s" % str(e), severity=hou.severityType.Warning, buttons=('Create geo node', 'Cancel'), default_choice=0, close_choice=1) == 0:
if geonode is not None:
raise RuntimeError('are we in an infinite loop?')
geonode = e.node().createNode('geo')
if pane is not None:
geonode.setPosition(pane.cursorPosition())
pane = None
continue
else:
hou.ui.displayMessage("Error: %s"%str(e),severity=hou.severityType.Error)
return
except RuntimeError as e:
hou.ui.displayMessage("Error: %s"%str(e),severity=hou.severityType.Error)
return
except RuntimeWarning as e:
hou.ui.displayMessage("Warning: %s"%str(e),severity=hou.severityType.Warning)
except Exception as e:
hou.ui.displayMessage("Internal Error: %s"%str(e),severity=hou.severityType.Error)
return
break
do(kwargs['pane'])
]]>
</scriptCode>
</scriptItem>
<scriptItem id="hpaste_webcopy">
<label>Copy Web</label>
<scriptCode>
<![CDATA[
from hpaste.hpasteshelffunctions import hcopyweb
hcopyweb()
]]>
</scriptCode>
</scriptItem>
<scriptItem id="hpaste_webpaste">
<label>Paste Web</label>
<scriptCode>
<![CDATA[
from hpaste.hpasteshelffunctions import hpasteweb
hpasteweb(kwargs['pane'])
]]>
</scriptCode>
</scriptItem>
</subMenu>
</subMenu>
</menuBar>
</mainMenu>
Private gists are private. There's no reason this application should require access to them. It's sketchy, potentially a security vulnerability, etc.
Good afternoon my friend.
I'm having a type of error in houdini18 which is as follows:
I cannot add nodes to my collection.
Then I have to go back to houdini 17, have him add it to my collection and then he appears on 18.
When you order your collection to be added at 18, he does not open the window to enter the name and send it.
Thank you very much .. Your plugin is fantastic.
hpasteweb.webPack(data, [list] = None, listForcedOrder=False, chunksize=None)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.