ZBrushCentral

Import multi .objs as Layers Help

I am in need of a way to import targets as layers into 4R7 for corrective sculpting similar to the way Maya can send to Mudbox a base and bring in it’s targets as layers. I see the Maya BlendShapes script supports exporting only, Subtool Master will append only, and have tested the .fbx importer but come up short.

I am wondering if anyone has setup something to effect of a multi .obj import as layer script. I am not the savviest scripter, but could give it a stab with guidance.

Many Thanks,

Dan

I wrote a plugin a while ago which helps with this. It’s Windows only, at the moment.

To install:
Unzip to your Desktop and open any folder created by the unzipping. Copy the ImportLayers_4R7_01.zsc file and ImportLayersData folder to your ZBrush 4R7\ZStartup\ZPlugs64 folder. This installs the plugin for ZBrush 64 bit. Also copy the ImportLayers_4R7_01.zsc file and ImportLayersData folder to your ZBrush 4R7\ZStartup\ZPlugs folder. This installs the plugin for ZBrush 32 bit. Restart ZBrush.

After installation there should be a new sub-palette called Import Layers in the Zplugin palette. Press the Import button to select a file from disk. It can be either OBJ or GoZ. The plugin will then scan the folder and import all the files that have the same number of points. Every time a new layer is created you’ll see the rename box. Just hit Ctrl+V on the keyboard and the file name will be entered from the clipboard. Press Enter and the plugin will continue to the next file.

The TurnOff button will simply turn off all layers.

ImportLayers_4R7_01.zip (31.1 KB)

Note: there is a new version which works with both Windows & MacOSX at post #9 below.

HTH,ImportLayers_4R7_01.zip (31.1 KB)

1 Like

Marcus,

The plugin in works great. Thank you for your help.

I’m running into an issue with the layer names. The clipboard is clipping most of the names characters out.

Would you be comfortable sharing your code? I’d like to expand on its functionality and integrate into a send/ update script to pass back and forth between Maya.

Best,

Dan

There’s a limit of 15 characters for layer names in ZBrush, so anything over that will be truncated. Is that the issue? There may be some special characters that aren’t recognised.

Hi Marcus,

First of all tnx for making this plugin available for us:). I find it very useful to reimport morphtargets/blendshapes from Max and being able to edit them back in zbrush.
Now I wonder in which order the obj’s get imported as layers. Could this be alphabetical? Now it looks quite random to me:p

Why can enter the same character at all? I think more gods?

Hi Marcus,

I wonder if you ever found time to make this for the Mac as well? In need, indeed.

Thanks

It should be possible. I’ll take a look later this week.

Here is a new version which will work with ZBrush 4R7 on both Windows and MacOSX. It will also automatically name the layers according to the imported file names.

To install:

Remove the previous version if you installed it - delete the ImportLayers_4R7_01.zsc file and ImportLayersData folder from your ZBrush 4R7\ZStartup\ZPlugs64 folder (and ZBrush 4R7\ZStartup\ZPlugs folder if you installed for 32bit ZBrush).

Unzip the zip file to your Desktop and open any folder created by the unzipping. Copy the ImportLayers_4R7_02.zsc file and ImportLayersData folder to your ZBrush 4R7\ZStartup\ZPlugs64 folder. This installs the plugin for ZBrush 64 bit. Also copy the ImportLayers_4R7_01.zsc file and ImportLayersData folder to your ZBrush 4R7\ZStartup\ZPlugs folder. This installs the plugin for ZBrush 32 bit. Restart ZBrush.

Buttons as described in the post above.

Download here: ImportLayers_4R7_02.zip (127 KB)ImportLayers_4R7_02.zip (127 KB)

WOW THAT WAS FAST! I unfortunately must have read this wrong a few days ago when I started a Google search to be able to import multiple 3D mesh sub tools. I am now reading this more closely and see that this solution in for layer scripts.

I then wonder, is there a way to import many .objs into ZBrush as separate subtools? rather than importing each one individually? That is what I meant.

Thank you.

Ha! :slight_smile: You can use the SubTool Master plugin (in the Zplugin palette) to do that. Click the Multi Append button. You can select OBJs from disk. Shift+click in the open file dialog to select more than one.

Thanks! I should’a known. But now I do.
Appreciated.:sunglasses:

perfect! thank you so much

This is awesome. any chance we could get the inverse too? export layers as obj?

be great if it was circular

import-export-import-export etc.

for those who may following after me. here’s how an OBJ stream can get read into blender.

and here’s how you can export an OBJ stream of shapes from blender:

Combined, these three scripts almost form a functional GoZ blender w shapekey/layer support no?. :wink:

-b

Thanks for this plugin, it’s a massive time saver!

Once thing of note: In what order are the objs being imported? It seems like they come in to Zbrush in the same order if you repeat the import process, but I can’t work out what that order relates to…

Can I use .dll fucntions with my zscript? Or is it possible to redo this funciton with only zscript now?

See my answer here:

Thanks. I also got a problem using FileNameSetNext, it works correctly with loading texture, but not working with [IPress,Zplugin:Import Layers:Import]. Did I miss anything?

    [VarSet, folderName, "D:\zbrush\Wrinkle\Facial for Layer"]

    [VarSet, fileCount, [FileExecute, [Var, dllPath], "GetFileNumber", folderName]]

    [If, fileCount > 0,

        [Loop, fileCount,

            [VarSet,err,[FileExecute,[Var,dllPath],"GetFile",,,fileName]]

            [If, err,

                [LoopExit]

            ]

            [MemReadString, fileName, fileToImport, 0]

            [FileNameSetNext, [StrMerge, "D:\zbrush\Wrinkle\Facial for Layer\", [Var, fileToImport]]][IPress,Zplugin:Import Layers:Import]

        ]

    ]

Did you create the memory block “fileName” correctly? (You should use something different for memory block names, so that they are unique - something like CJ_File_Mem - otherwise you risk conflicts.)

Also, you appear to be pressing a plugin button with [IPress,Zplugin:Import Layers:Import] This won’t work as control will pass to that plugin and your code will cease to run.

Marcus

Is there any work around to import .obj as layers with zscrpit? Or can I make a zscript that calls LayerToolsDLL directly?