nbakovic Posted September 30 Share Posted September 30 I've been working on a marionette script that would enable me to rename multiple objects at the same time. There are a couple of reasons I this comes in handy, one of them being a quick way to isolate things using the data visualization tools. I work in exhibit design and so the files tend to be a mess with multiple imports from different architects, contractors, etc. Assigning everything to layers and classes isn't always the most efficient way to go, so appending names with different keywords is really helpful. My problem is that I can't figure out how to apply the same rename command, with sequential numbering at the end of the name, without using lists. This wouldn't be a problem if I wasn't trying to set my upper limit of objects at 200 at the same time. The script does what I want it to do, however wrapping it and turning it into a menu command takes a really long time. Does anyone have any idea on how to make this more efficient? Multi Object Rename.vwx Multi Object Rename.vwx Quote Link to comment
Marionette Maven Marissa Farrell Posted October 1 Marionette Maven Share Posted October 1 This is a great question. I'll start with some technical information about how Marionette nodes run. There are two typical ways a node can run - a node with black text for a name will run as many times as the longest list, repeating the last value of the shorter list(s) until the longest list has gone through all of its values, however, a node with gray text will "absorb" all of the values fed into it and run just once while manipulating that all within the python code. There are some nodes that will take an input of a list and "absorb" just that input, but it still remains to run based on the longest list for any input that isn't receiving the inputs all at once. The file you've shared doesn't appear to have any example objects to test with, so it's a little harder for me to make sure my suggestion would work, but theoretically since each of your wrapper nodes are taking the first 2 inputs from the same wires, you should be able to just use ONE wrapper for each of the input list nodes instead of having to explode that last list which would eliminate a LOT of wires in this network. If you could share a sample file with objects that you'd run this on, I can make better suggestions. If what I explained above wasn't clear, please let me know and I'll try to come up with a simple example to demonstrate. 1 Quote Link to comment
nbakovic Posted October 1 Author Share Posted October 1 Thank you for the reply Marissa! I tried making the changes you suggested and the result is that it adds all the name to the first object, but then leaves the others untouched. I also realized that the way I had it set up simply didn't work on symbols and only sometimes worked on hybrid symbols., which is rather unfortunate. I've tried your suggestion and my original network on the attached file which contains a series of 2D square, 3D cubes, and 3D cube symbols. If you have any idea on how to get it to work on symbols I'd greatly appreciate it, other it's back to the drawing board for me. Multi Object Rename 02.vwx Quote Link to comment
Marionette Maven Marissa Farrell Posted October 2 Marionette Maven Share Posted October 2 So the issue with my suggestion is within your wrappers (the list node and the concatenate node) because as I explained before, they're absorbing the lists (resulting in your long string name at the end and not individualizing each item being passed in.) I'm re-writing that wrapper to try to streamline things for you, but I have some questions about your network in general. For my understanding, what is the purpose of chunking your initial list into the smaller sublists? What is the importance of the upper 200 limit? Is there an order you're trying to preserve with the objects for the numbering? I'm really close to getting something much "prettier" done, but just want to make sure I'm within your requirements. (I'd personally like to remove all of the duplicate wrappers unless there's a real reason why you need so many. We can always limit to 200 in another way if that's important.) Quote Link to comment
Marionette Maven Marissa Farrell Posted October 2 Marionette Maven Share Posted October 2 Here's where I'm at - my network is boxed in red. I do believe we had a misunderstanding from my original suggestion, but it's not really important at this point. Please note that I changed the criteria to rectangles instead of selected just to not have to update a Marionette command each time. It *should* work with the Selected and in a menu command still with no issues. The "str" node in the wrapper is custom, everything else is default content. I added an output to your wrapper just to easily be able to see the resulting names. Multi Object Rename 02 v2025_MFarr v2024.vwx Quote Link to comment
nbakovic Posted October 2 Author Share Posted October 2 Thank you Marissa, After looking at the network, I definitely see how I misunderstood what you were saying. I tried the network on a few different things and it works really well as a marionette command. The custom "str" node you include seems to be crucial which makes me think that I need to start exploring custom nodes more. Quote Link to comment
Marionette Maven Marissa Farrell Posted October 3 Marionette Maven Share Posted October 3 Custom nodes absolutely can come in handy, however, I actively try to improve the content we ship to reduce the need to write your own. Sometimes I'm not aware of something not existing yet, and questions like these help me fill in the holes. Ideally I would have liked to use the concatenate node, but the way it was written doesn't allow it to receive a list of lists. It's on my list of improvements for later releases. It does sometimes help to have a basic to intermediate understanding of Python. For example, it's not obvious that you could use the "add" node to concatenate strings, most people would assume you can only sum numbers with it. Python is incredibly flexible and I'm a big advocate of users of Marionette that are curious to explore what the possibilities are. Quote Link to comment
nbakovic Posted October 3 Author Share Posted October 3 Your work is greatly appreciated and I'm sure I speak for a lot of people here. Python is the next training I will be doing so I am looking forward to it. I have an idea for a vitrine tool that I would love to build for my team and I am fairly certain that I'll need python for that. Quote Link to comment
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.