cwalrus Posted March 10, 2016 Share Posted March 10, 2016 (edited) Hi - I've imported an FBX into my scene, and I want to unlock all of the base nodes so that the entire file is referenced, rather than being baked into the project. How can I do this, other than digging deep down into each and every piece of geo, and unlocking the nodes? (unchecking the red flag) Thanks! Also - How can you replace an FBX already in your scene? i.e. i'd like to move it into my HIP directory now (should have before!) Edited March 10, 2016 by cwalrus Quote Link to comment Share on other sites More sharing options...
Atom Posted March 11, 2016 Share Posted March 11, 2016 (edited) Zoom way out and select all the nodes. Then zoom way in and click the Flag you want to change on a single node. All the nodes in the selection will change as well. I have used this to hide and show many bone nodes too. Remember you can also select by node type by clicking on the Magnifying Glass icon in the network view. Replacing the file name path would probably require a short python script. Some logic to preface each file name field with $HIP... Edited March 11, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
cwalrus Posted March 11, 2016 Author Share Posted March 11, 2016 Thanks mate - I thought of that, but I can't select all the sub nodes, where this red lock flag is located - do you know what I mean? Here are the main FBX nodes: and here's a node within those nodes, which has the red "Lock" flag I'm trying to unlock: Is there some sort of attribute spreadsheet maybe, like in Maya? Or some way to expose the nodes within the nodes? like expand the entire node tree...? Quote Link to comment Share on other sites More sharing options...
cwalrus Posted March 11, 2016 Author Share Posted March 11, 2016 Update: So there is a way to get the list view to show the entire tree - however now I need a way to expose the entire heirarchy with one click... (rather than clicking each + ... 1000 of them) That way I can then click on that "Lock" button on the right... But seriously, this is getting ridiculous. There must be some way to automatically do this for an FBX file - this is not production-friendly! Anyone? Thanks for advice! Quote Link to comment Share on other sites More sharing options...
Atom Posted March 11, 2016 Share Posted March 11, 2016 (edited) This works on a FBX I imported from MakeHuman, it may work for you. Dive inside the subnet and create a python node. Paste this code into the Python node. It may take a while on a 1,000 nodes so let this single CPU process run it's course. When it is finished delete the python node or it will run again on the next update. #NOTE: This code expects to run inside the root of a sub-net from a FBX import. import os # Detect the path to this subnet. node = hou.pwd() r = "%s" % node.allNodes n = r.find("/") if n != -1: s = r[n:-2] node_path = s[:-len(str(node))] else: # Detection failed, set path manualy. node_path = r"/obj/name_of_my_fbx/" def childrenOfNode(node, filter): # Return child nodes of type matching the filter (i.e. geo etc...). result = [] if node != None: for n in node.children(): t = str(n.type()) if t != None: for filter_item in filter: if (t.find(filter_item) != -1): # Filter nodes based upon passed list of strings. result.append('%s~%s' % (n.name(), t)) # name~type. result += childrenOfNode(n, filter) return result # Scan object geo nodes looking for File or Capture nodes inside. nodes = childrenOfNode(hou.node(node_path),["Object geo"]) for (j,node_root) in enumerate(nodes): ary = node_root.split("~") if len(ary) > 0: node_parent_candidate = "%s/%s" % (node_path, ary[0]) n = hou.node(node_parent_candidate) if n !=None: node_type = str(n.type().name()) if (node_type=="geo"): # Look inside this geo node for any file or capture nodes to modify. print "looking for children on node [%s]." % node_parent_candidate temp_nodes = childrenOfNode(n,["Sop file", "Sop capture"]) for (i,node) in enumerate(temp_nodes): print node ary = node.split("~") if len(ary) > 0: node_candidate = "%s/%s" % (node_parent_candidate, ary[0]) n = hou.node(node_candidate) if n !=None: node_type = str(n.type().name()) if ((node_type=="file") or (node_type=="capture")): # This a candidate for removing the hard lock. n.setHardLocked(False) if (node_type=="file"): # This is a candidate for re-writing the file path. original_path = n.parm("file").eval() file_only = os.path.basename(original_path) new_path = "$HIP/geo/%s" % file_only n.parm("file").set(new_path) print original_path print file_only print new_path Unfortunately Houdini insists on converting $HIP into the actual file path so make sure that your file is stored where you want it to be before you run this code. Edited March 11, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
cwalrus Posted March 11, 2016 Author Share Posted March 11, 2016 DAG NABBIT! I originally imported the FBX from a directory outside of my HIP directory... So I will copy it to my HIP directory, import it freshly, replace it's usage in the file (ARG!) and then try out your script, for which I am very grateful, by the way! Quote Link to comment Share on other sites More sharing options...
michael Posted March 11, 2016 Share Posted March 11, 2016 can you try re-importing the FBX but turn ON: Unlock Geometry File SOPs Unlock Deformation File CHOPs that's what these parameters are for. Quote Link to comment Share on other sites More sharing options...
cwalrus Posted March 11, 2016 Author Share Posted March 11, 2016 aha - yes that's good info, for next time I import one. But now, is there a way to replace the one that i've already imported? Quote Link to comment Share on other sites More sharing options...
michael Posted March 11, 2016 Share Posted March 11, 2016 delete. import. ? even if there are other things in your scene that are relying on the current FBX, deleting it and re-importing should produce the same node names etc, so things should hook up again it's worth a try. Quote Link to comment Share on other sites More sharing options...
cwalrus Posted March 11, 2016 Author Share Posted March 11, 2016 actually that's a great idea, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.