@@ -316,6 +316,45 @@ def exportNodes(self, allSetups=True):
316316 return
317317 rbf_io .exportRBFs (nodesToExport , filePath )
318318
319+ def update_rbf_solver_reference (self ):
320+ """Open file dialog and update solver name in selected .rbf or .ma file.
321+
322+ Replaces all occurrences of 'weightDriver' with 'mGearWeightDriver' and
323+ saves the modified file in the same folder with a '_RBF_solver_updated'
324+ suffix. Displays how many replacements were made.
325+
326+ Returns:
327+ str: Path to the updated file or None if cancelled.
328+ """
329+ file_path = mc .fileDialog2 (
330+ fileFilter = "RBF/Maya ASCII (*.rbf *.ma)" ,
331+ dialogStyle = 2 ,
332+ fileMode = 1
333+ )
334+
335+ if not file_path :
336+ return None
337+
338+ source_path = file_path [0 ]
339+ base , ext = os .path .splitext (source_path )
340+ new_name = os .path .basename (base ) + "_RBF_solver_updated" + ext
341+
342+ new_path , count = mString .replace_string_in_file (
343+ "weightDriver" ,
344+ "mGearWeightDriver" ,
345+ new_name ,
346+ source_path
347+ )
348+
349+ mc .confirmDialog (
350+ title = "RBF Solver Update" ,
351+ message = "Updated file saved:\n {}\n \n Replacements made: {}" .format (
352+ new_path , count ),
353+ button = ["OK" ]
354+ )
355+
356+ return new_path
357+
319358
320359class RBFManagerUI (widget .RBFWidget ):
321360 """A manager for creating, mirroring, importing/exporting poses created
@@ -1925,6 +1964,10 @@ def createMenuBar(self, hideMenuBar=False):
19251964 "Delete All Setup" ,
19261965 partial (self .menuFunc .deleteSetup , allSetup = True ),
19271966 )
1967+ file .addSeparator ()
1968+ file .addAction (
1969+ "Update file to mGear Weight Driver Variant" ,
1970+ self .menuFunc .update_rbf_solver_reference )
19281971 # mirror --------------------------------------------------------------
19291972 mirrorMenu = mainMenuBar .addMenu ("Mirror" )
19301973 mirrorMenu1 = mirrorMenu .addAction ("Mirror Setup" , self .mirrorSetup )
0 commit comments