stripping the .hip extension in $HIPNAME

   8736   3   2
User Avatar
Member
119 posts
Joined: 7月 2005
Offline
hi there, how do i get the variable to drop teh .hip part when i`m using $HIPNAME so that it returns

scene_01 instead of scene_01.hip

for example.

cheers,

Mark
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
in hscript for example:
`strreplace($HIPNAME, “.hip”, “”)`
or longer:
`substr($HIPNAME, 0, strlen($HIPNAME)-4)`

in python:
hou.hipFile.name()
(in case of noncommercial last two would fail since we have 6 signs: .hipnc)

or (python version of hscript trick):

hou.hipFile.name().replace('.hip', '')

maybe the most certain way:
import os.path
os.path.splitext(hou.hipFile.name())

cheers,
sy.
User Avatar
Member
25 posts
Joined: 12月 2005
Offline
The simplest in HScript seems to be:
$HIPNAME:r
Frederic Servant / Solid Angle / London
www.solidangle.com
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
kikou
The simplest in HScript seems to be:
$HIPNAME:r

Nice tip, thanks!
  • Quick Links