问题描述:
如何使用Python设置houdini的首选项
相关方法
Houdini中和PREFERENCES相关的有三个方法。
官方文档
hou.getPreference()
getPreference(name) → string
这个方法根据属性的名字返回属性的值
hou.getPreferenceNames()
getPreferenceNames() → tuple of strings
这个方法将会返回所有Preference属性的名字,便于查询
# 这是打印结果
('composites.cinplut.val', 'general.voppreview.val', 'networkeditor.wirefadefactor', 'networkeditor.textbadgeoutputf
orview', 'networkeditor.textbadgedescriptiveparm', 'networkeditor.taskgraphlimitrows', 'networkeditor.solohighlighte
dworkitems', 'networkeditor.showpreviews', 'networkeditor.shownodetypes', 'networkeditor.shownodeshapes', 'networked
itor.showfailedworkitems', 'networkeditor.showdirtyworkitems', 'networkeditor.showcookedworkitems', 'networkeditor.s
howcancelledworkitems', 'networkeditor.maxworkitemsperrow', 'networkeditor.maxtaskgraphrows', 'networkeditor.maxflyo
utscale', 'networkeditor.doautomovenodes', 'networkeditor.badgevexcache', 'networkeditor.badgetimedep', 'networkedit
or.badgeneedscook', 'networkeditor.badgehdaunlocked', 'networkeditor.badgehdalocked', 'networkeditor.allowdroponwire
', 'networkeditor.TopInOutColor_8', 'networkeditor.TopInOutColor_4', 'networkeditor.TopInOutColor_17', 'networkedito
r.TopInOutColor_16', 'networkeditor.TopInOutColor_15', 'networkeditor.badgehastakedata', 'networkeditor.badgenodeloc
ked', 'networkeditor.TopInOutColor_10', 'networkeditor.TopInOutColor_0', 'networkeditor.TopInOutColorTag_9', 'networ
keditor.TopInOutColorTag_8', 'networkeditor.TopInOutColorTag_7', 'networkeditor.TopInOutColorTag_6', 'networkeditor.
TopInOutColorTag_5', 'networkeditor.TopInOutColorTag_4', 'networkeditor.TopInOutColorTag_19', 'networkeditor.TopInOu
tColorTag_18', 'networkeditor.TopInOutColorTag_17', 'networkeditor.TopInOutColorTag_16', 'networkeditor.TopInOutColo
rTag_14', 'networkeditor.TopInOutColorTag_13', 'networkeditor.showcookingworkitems', 'networkeditor.TopInOutColorTag
_12', 'networkeditor.TopInOutColor_12', 'networkeditor.TopInOutColorTag_11', 'AP_KeyboardHit', 'exttools.foldercompa
re.options', 'exttools.filecompare.options', 'exttools.filecompare.path', 'ui.textport.paren', 'networkeditor.badgew
arning', 'networkeditor.TopInOutColor_1', 'ui.textport.syntax', 'networkeditor.TopInOutColor_6', 'ui.editor.paren',
'ui.parm.paren', 'ui.parm.syntax', 'notify.timelimit.val', 'networkeditor.TopInOutColorTag_10', 'notify.helptip.menu
', 'hipoptions.unitmass.val', 'hipoptions.unitlength.val', 'misc.opencl_env.override', 'misc.make_spare_parms.val',
'misc.externalhelpurl.val', 'take.autoincludeassets.val', 'general.autosaveinterval.val', 'general.newfilesavescenef
ormat', 'resmgr.showhidden.val', 'notify.timelimited.val', 'resmgr.autosave.desk.val', 'misc.cansendanonymousstats.v
al', 'render.showallrops.val', 'anim.underlinescoped.val', 'anim.underlinescopedcolor.val', 'anim.followscopedchanne
lreferences.val', 'objects.linkchopviewer.val', 'notify.location.menu', 'ui.textport.help', 'anim.includeconstraints
.val', 'anim.includechild.val', 'networkeditor.badgenodeunload', 'anim.includeanim.val', 'objects.linkchanneleditor.
val', 'networkeditor.maxnamewidth', 'anim.autoupdatechannels.val', 'networkeditor.badgeconstraints', 'networkeditor.
showprompttext', 'anim.setautoscope.val', 'anim.nopendingkey.val', 'anim.autokeytuples.val', 'general.newfilesavesce
neformat.val', 'anim.slope.val', 'anim.firstfunc.val', 'states.bones.autoenablecplane.val', 'networkeditor.badgenotc
ompilable', 'states.curve.autoenablecplane.val', 'states.objcurve.autoenablecplane.val', 'misc.restricttosafe.val',
'menu.val', 'handles.defaultxformglobal.val', 'anim.autofunc.val', 'states.path.autoenablecplane.val', 'networkedito
r.badgenodehasdata', 'handles.defaultgimbal.val', 'handles.viewaxisrotatering.val', 'handles.useviewdirtohiderotater
ings.val', 'handles.indirectdragprefertranslateoverscale.val', 'handles.indirectdragprefertranslateoverrotate.val',
'resmgr.pathbehaviour.val', 'anim.autoslope.val', 'networkeditor.TopInOutColor_7', 'handles.tumbleinside.val', 'gene
ral.loadwarndeprecated.val', 'networkeditor.TopInOutColor_9', 'handles.planartranslatetargets.val', 'anim.holdlastke
y.val', 'networkeditor.badgecomment', 'handles.extendedaxes.val', 'handles.pickdistance.val', 'handles.scalehandlest
yle.val', 'handles.axistoorienttonormal.val', 'handles.indirectdragspidermethod.val', 'handles.indirectdragtranslate
method.val', 'networkeditor.TopInOutColor_11', 'anim.firstfunc.menu', 'misc.useexternalhelp.val', 'viewport.locateco
mponents.val', 'networkeditor.TopInOutColorTag_3', 'misc.revert_invisible.val', 'viewport.setpivottumbledefault.val'
, 'networkeditor.textbadgeloplastmodifiedprim', 'handles.indirectdrag.val', 'viewport.autosetviewpivotonselection.va
l', 'general.undolimit.val', 'networkeditor.TopInOutColor_5', 'viewport.scrollstyle.val', 'viewport.wire_toggle.menu
', 'viewport.lightpasscolorbuffertype.val', 'viewport.allowadaptivesubd.val', 'viewport.offsetzoomdefault.val', 'vie
wport.wiretoggle.val', 'networkeditor.TopInOutColor_14', 'viewport.orientation.val', 'networkeditor.badgeerror', 'vi
ewport.defaulthoming.val', 'objsop.switch.val', 'handles.indirectdragprefertranslateovervrotate.val', 'objcache.memo
ry.val', 'ui.parm.help', 'sopcache.unload.val', 'networkeditor.showtaskgraph', 'network.autohighlight.val', 'network
editor.TopInOutColor_13', 'selector.areaselvisible.val', 'objects.folderflipping.val', 'sopcache.memory.val', 'objec
ts.highlight.val', 'anim.setfirstkey.val', 'trees.displayicons.val', 'networkeditor.textbadgelayercount', 'objcache.
memorylimit.val', 'tiles.perfstats.val', 'chops.mincooks.val', 'tools.secure.val', 'networkeditor.maxnameheight', 'r
esmgr.showall.val', 'networkeditor.minnameheight', 'objects.keepPos.val', 'networkeditor.shakesensitivity', 'general
.autosaveinc.val', 'networkeditor.snapradius', 'sopcache.level.val', 'networkeditor.flagsallowpreselect', 'networked
itor.badgedynamictop', 'exttools.filecompare.menu', 'handles.hidelockedparts.val', 'networkeditor.allowdiveintohdas'
, 'networkeditor.transientinfo', 'networkeditor.TopInOutColorTag_1', 'networkeditor.showvopinoutlabels', 'sopstates.
exportcookselectiontype.val', 'tools.createincontext.val', 'misc.destructive_revert.val', 'networkeditor.TopInOutCol
orTag_2', 'networkeditor.showanimations', 'networkeditor.TopInOutColorTag_0', 'objects.overwriteanim.val', 'networke
ditor.gridsnapping', 'chops.deftimeslice.val', 'parmdialog.embedviseditor.val', 'networkeditor.dosnapping', 'general
.audionotice_question.val', 'networkeditor.TopInOutColor_3', 'ui.editor.toolbar', 'tools.sopviewmode.val', 'anim.add
edfunc.val', 'anim.addedfunc.menu', 'general.audionotice_warning.val', 'handles.translateinside.val', 'general.lod.v
al', 'networkeditor.connectorsnapradius', 'general.lefthandmenus.val', 'tools.opnamespacefilter.val', 'general.fileb
rowserimages.val', 'objects.openchanneleditor.val', 'networkeditor.textbadgecomment', 'networkeditor.showstaticworki
tems', 'general.smoothlines.val', 'general.audionotice_message.val', 'general.uiscale', 'general.nopending.val', 'ge
neral.filechooserstyle.menu', 'networkeditor.textbadgecontextoptiondeps', 'general.saveviewcmds.val', 'objects.kinov
erride.val', 'objects.keepPosMoving.val', 'general.inc.val', 'sopcache.memorylimit.val', 'selector.useexisting.val',
'viewport.delayinactive.val', 'anim.keepchannelselection.val', 'misc.opencl_device.menu', 'handles.openchanneledito
r.val', 'misc.opencl_devicetype.menu', 'viewport.oldtumble.val', 'handles.colorxform.val', 'handles.scope.val', 'net
workeditor.copypathstoclipboard', 'notify.echohotkey.val', 'networkeditor.badgelopdebug', 'networkeditor.showsimples
hape', 'general.icon_size.menu', 'networkeditor.TopInOutColor_18', 'networkeditor.TopInOutColor_2', 'networkeditor.s
howstackedlook', 'exttools.foldercompare.path', 'general.coppreview.val', 'point_percent.val', 'handles.translateins
ideobscuresbackaxes.val', 'networkeditor.badgekinematics', 'delpoint.val', 'objects.pickingmenu.val', 'networkeditor
.TopInOutColorTag_15', 'handles.defaultworldalign.val', 'general.panecoloring.val', 'handles.keepalign.val', 'tools.
maxhistory.val', 'general.audionotice_error.val', 'anim.setkey.val', 'addpoint.val', 'objects.selectsubnet.val', 'FU
SE_PREF.ramp_val', 'anim.rotationfunc.menu', 'ramp_color_schemes.val', 'scripting.exprlanguage.menu', 'anim.rotation
func.val', 'general.uiplaybar.menu', 'viewport.altkeyviewcontrols.val', 'general.desk.val', 'handles.scale.val', 'ge
neral.keepfloatwindowsontop.val', 'networkeditor.TopInOutColor_19', 'viewport.directeddollydefault.val', 'networkedi
tor.distancefordrag', 'ui.editor.syntax', 'objcache.clear.val', 'open.val', 'networkeditor.showpartitionworkitems',
'ok.val', 'misc.parmdel_warnings.val', 'selector.fullloops.val', 'chops.maxtimeslice.val', 'networkeditor.autoscroll
', 'rendererListVscroll')
hou.setPreference()
setPreference(name, value) → bool
设置属性的值,如果成果就返回True
实际操作
简单来说就是先通过 hou.getPreferenceNames() 获取到想要修改的属性名,然后再通过 hou.setPreference() 进行操作,非常简便