Search the Community
Showing results for tags 'scripting'.
-
Hi, I have to get the last character of the node's name into group parameter of blast node. In this case, the name of blast node is blast1, so I need the last character 1, and put it in into group parameter. nodeName = hou.node(".") last_char = nodeName[-1] return(last_char) And I get error Error: Unable to evaluate expression ( Traceback (most recent call last): File "<stdin>", line 3, in expression TypeError: 'SopNode' object is not subscriptable (/obj/geo1/blast1/group)).
- 2 replies
-
- scripting
- expression functions
-
(and 2 more)
Tagged with:
-
Hi! This is my first post to this wonderful forum, my teacher recommended it to me since I'm the only one in my CG-course to want to work with Houdini and the autodidactic approach can be harsh sometimes I was following the classic "vex isn't scary"-tutorial on for loops and decided I wanted to try to make the "infected" points also move into a new position within the foreach-loop after they've become infected, which worked fine. But then I tried to create a float parameter that blended the initial position of each point and the new position, so that you are able to see them moving towards the center as they became infected, and got completely lost in the sauce. Anyone know how to write that in VEX? I attached the file with directions. Looking forward to spending time within this community, you guys are awesome! FORLOOPS_VEX.hipnc
-
According to https://www.sidefx.com/docs/houdini/hom/tool_script.html: Ok, so stateutils is the more high-level API, unlike toolutils/soputils/doputils, right? So where is the documents for stateutils?
-
version 18.0.287, 18.5.462 I am trying this manually (right click on parameter name >> lock parameter) and using python hou.geometry.SetHardLocked(True) but nothing is working on this. In addition, it will crash if I try to change that parameter after lock. Any other choices or reason why this doesn't work?
-
hello , it's my first time i use python in houdini fx i know python from before but i never used it in houdini fx and it seems it's easier than vex to achieve the same task, my problem is i have an fbx file with shop_materialpath and there are different name in shop_materialpath i want to create a string channel for each unique name , that string channel it will be a path for ue4 material for example if i have 2 different name in shop_material the first one is TS_02 and the second is Roof_01 i want to create 2 string channel to expose it later to ue4 using hda first string pathmat1 and the second one is pathmat2 and they will be applied in an attribute name unreal_material or path , i want to automate this process because i want it to work on random asset if i dont know the name of the shop_materialpath the python script should loop in each primitive and see how many name there are in shop_material path and create string channels for them . i already made a script to store the name of the shop_materialpath in a dictionary and then i lost from where should i continue idk how to access primnum in python and idk how to create string channel like in vex using chs() here is my python code # Run a generator Box SOP Verb def grp_n(grp): myDict={} for mat in grp: if mat in myDict: myDict[mat]=1 else: myDict[mat]=1 return myDict node = hou.pwd() geo = node.geometry() dict={} list=[] for pri in geo.prims(): list.append(pri.attribValue("shop_materialpath")) l=grp_n(list) print l and i made a simple code in vex but in this case i already know the shop_material names and im testing using if conditions and applying string to the unreal_material , i want to automate this process to check how many names there are in shop_material path and then creating string channels for each one, sorry i dont know how to explain this in an easy way but my english is not too good string id1=chs("uemat1"); string id2=chs("uemat2"); string id3=chs("uemat3"); // testing conditions comparing the groups name if(s@shop_materialpath=="TS_02"){ s@unreal_material=id1; } else{ s@unreal_material=id2; } if(s@shop_materialpath=="Emissive_01"){ s@unreal_material=id3; }
-
Hello, I am creating an digital asset for a personal project that I am working on. As soon as I saved the digital asset, all the parameters are locked and I cannot change it. Can someone please tell me how to edit those parameters? I have attached a screenshot of edit parameter interface, in parameter description, you can see all of the fields are locked except for a few. Thanks for your help
-
hey guys! I require help understanding how to get a list of objects/instances/geo based on the intersection of bbox of custom geo being placed in a scene. How can we get the information? Thanks
-
externaldragdrop.py - only works on some machines? not all
danielsweeney posted a topic in Scripting
Hi everyone, has anyone come across this problem before? been setting up a custom script for drag and drop via the externaldragdrop.py file. Now the weird thing is. it works on some machines and not others. works on my home machine, a colleagues home machine. one of the machines at work and two other and work is does do anything. Whats seems to be happening is houdini, is not even registering that a file is being attempted to be dropped form an external window. So the .py file cant be called? I can't seem to find any documentation on this either which does not help. all machines at work are running the same environment setup. any ideas?? cheers Daniel Happy new year to all -
Hello fellow magicians, I'm using PySide2 and PyQt to make a button that merges an already existing .hip file with the current open scene. After reading the Documentation, I'm under the impression that the method hou.hipFile.merge('path_to_merging_file') is what I'm looking for... But after using this method, Houdini tries to load the file in the path. Can some one point out what I'm doing wrong? Solved: I think the problem was that I didn't have my current open scene saved... And Houdini also imports the display options from the merged file, so I thought I was in the .hip file I wanted to merge
-
Hello guys, Im a noob to python and Houdini in general. Now that we've got that out of the way, I am just testing out python, and i tried to create a little task for myself. I made a curve, and brought it into a new geo node, via object merge, and resampled the curve to 5 segments. I am attempting to make a loop, so a box is created on each of the 5 points on the resample node. Is there a way I can access the Px, Py and Pz attributes of the resample node from the geometry spreadsheet using python? I tried the get attribute code but i have received error message upon error message. Thanks!
-
hey guys , how can I calculate the volume of an object in VEX , I want to write something like this one below: the line of your script * volume of a specific object I used getbbox_size but the result is a scalar. I want everything in the object to have the effect. what should I do? best regards
-
Hi guys, Could you any of you please help how to setup frustum culling or geo/obj culling based on bbox intersection with a given cube/box/sphere? Please let me know if you guys can help me out? Appreciate your time! Cheers!
-
Hi Guys, I have a number of nodes within OBJ level. Could anyone help me out with aligning selected nodes and aranged within Network Box? Python script. Thank you !
-
Hi All, I am creating a flipbook using below python code and calling those image seq. in nuke but while importing it's colorspace is set to paintspace if I change this to sRGB then things look fine but the issue is I don't have any controls on NUKE function as it's implemented in database and works simply if i pass a image seq in it. Is there any other way I can fix issue while exporting from houdini itself. There are 2 things I came to know about it but don't know this are the actual cause of issue. Houdini Menu > Edit > ColorSetting > Colorcorrection MPlay > Colorcorrection Bar If above are the solution to fix this issue then what exactly has to be done in python way ? If above are not the solution then how to fix this issue ? flip_book_seq_path = '/u/{}/Desktop/flip.$F4.exr'.format(USER) cur_desktop = hou.ui.curDesktop() scene = cur_desktop.paneTabOfType(hou.paneTabType.SceneViewer) flip_book_options = scene.flipbookSettings().stash() flip_book_options.output(flip_book_seq_path) start_f = 1001 end_f = 1002 flip_book_options.frameRange((start_f, end_f)) flip_book_options.outputZoom(100) flip_book_options.useResolution(1) x = 1980 y = 1020 flip_book_options.resolution((x, y)) flip_book_options.cropOutMaskOverlay(1) scene.flipbook(scene.curViewport(), flip_book_options)
-
hi all, This is a bread and butter problem, solved in many different ways....remove (cull) the outside piece primitives after a "Boolean Fracture". Ive been looking for a simple and fast VEX solution (not... for-each loop nodes) I found one that seems in the right direction as I love its simplicity. (was trying this in detail mode) If anyone has other or a more elegant VEX solution I would love to explore it, cheers int insides [] = expandprimgroup(0, "inside"); int outsides[] = expandprimgroup(0, "outside"); foreach(int inside; insides) { int success; string insideName = primattrib(0, "name", inside, success); foreach(int outside; outsides) { string outsideName = primattrib(0, "name", outside, success); if(insideName == outsideName) { setprimgroup(0, "inside", inside, 0, "set"); setprimgroup(0, "outside", inside, 1, "set"); setprimattrib(0,"Cd",outside,set(1,0,0),"set"); //small test using the colour break; } } } as usual any help appreciated.
-
Hey guys! Once again, I have to seek out your precious help ^.^ I am currently creating my own asset browser and I am working on feeding assets from Houdini into the library. So far, everything was going pretty smoothly up until I got stuck with something that seems so simple: the frameSelected() function of the hou.GeometryViewport class. When I use the Python shell inside Houdini and do this, it is working correctly: import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() My section in the HDA is not. Broken down to the essential part (with hard coded selection of node as above for the sake of the example): import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() [...] cam = obj_level.createNode('cam', 'asset_cam') node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() view.saveViewToCamera(cam) view.setCamera(cam) All the other functions work as expected (lockCameraToView, saveViewToCamera, setCamera all work fine). I only have trouble with frameSelected(), even when adding the code from the shell to my script, basically hard coding selecting the correct node. After running my export process which does not frame the view, I can go to the shell and call frameSelected() and from there it works again :/ I also have sections where I first set the camera, lock the view, then try framing but it is the same result: all working, except the framing. I wonder what I am doing wrong in my code and hope you can help me out. Any pointers, comments are greatly appreciated!
-
Hi guys, Just a quick question I hope have a simple answer! I have a dual boot setup and switch back and forth between Win and Linux. Due to files having to point to same location I have a variable in the .env that point to each respective mounting place $NAS. Now, I imported an FBX through the File menu and it pops in as expected, but all the nodes have the full path in them. With the Textport I can do the "opchange" operation to switch the mounting place to the variable - but when I do that it converts the variable to it's value (the original path). My question now is: Can I somehow do the opchange without the Textport converting the variable to it's value and simply make it put the variable there instead of the path? I hope my rambling is not too confusing. Thanks a bunch, Jack
-
Hi all I've been looking at creating usd variants from the following, thinking on using this to create a model with variants from a piece of geometry that has a primitive attribute called "myattr" with 2 values (say half a sphere with myattr="left", and the other side called "right") 1- sopimport an object into LOPS with prim attributes. 2- create an add variant to existing primitive block 3- done Any ideas on how to iterate through each of the primitive attribute values to create this variants? adding a hip file for reference, maybe someone can help Thanks in advance! usdvariants_from_groups.hipnc
-
Hi all I've been looking at creating usd variants from the following, thinking on using this to create a model with variants from a piece of geometry that has a primitive attribute called "myattr" with 2 values (say half a sphere with myattr="left", and the other side called "right") 1- sopimport an object into LOPS with prim attributes. 2- create an add variant to existing primitive block 3- done Any ideas on how to iterate through each of the primitive attribute values to create this variants? adding a hip file for reference, maybe someone can help Thanks in advance! usdvariants_from_groups.hipnc
-
Greetings, I am trying to use addpoint() every 24 frame and i wanted it to stay in the geometry. The problem is that the newly added point is only available in that specific frame. I want to add a point every 24 frame. and make it permanent. is there a way to add permanent point ever 24 frame? any help would be appreciated. Thanks, P.S: the code is like this: if (@Frame%24==0) { int index = addpoint(0,@P); int setPtAttrib = setpointattrib(0, "move", index, 1, "set"); }
-
Hey, Hi, I want to rig a realistic women character, Can someone tell me what is the way to rig a realistic character I'm planning to use a Advanced skeleton in maya, and including the blendshapes can also be helpful? or else painting my own weights will give the better result? ThankU.
-
Hi Houdini friends, I'm having a pretty weird issue right now and was wondering if this is something that someone else has encountered before: When I call a function as a callback to some button on an HDA/ shelf script, the result is different from when I directly call it in the python shell of an opened Houdini session / directly in a hython shell. More specifically, when called as a callback, it hangs; while when called from hython it went through as expected; The function involves some general wrapping code, that execute some houdini specific code, and it seems that any call from the hou module would hang when ran as callback. Does anyone have similar issues before / knows more about what might be different when something is executed as parm callback vs. directly from hython? Thanks soooooo much in advance!
-
Hi, I'm trying to make folder structure from python... there is a renaming problem I'm facing... How do we can make "vnc_001.......vnc_015", please check the image attached, I strongly required only 3 numbers at the end...
-
I just did a Python script to create a sphere only with nulls. Actually can be done any shape you want. Here the video with the HIP file included: I know, it's a completely useless and silly project, but was fun to do. Any comment will be welcomed, Oscar