Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

16 Good

1 Follower

About opusGlass

  • Rank
  1. Rigging and exporting meshes in Blender 2.7

    A new version of the blender Nif plugin was released in 2018, despite the version number remaining the same. As a result, my patch files have been updated to a 2018 version. Make sure both are up-to-date! Additionally, I've now fixed an error related to Unassigned Body Parts, and updated that section of the instructions with new info.
  2. Hi all, I spent a good chunk of time figuring out how to reset/respawn an Ore Vein so that it can be mined again. So, I figured I'd post my solution here. This is Papyrus code. The gist of it is: OreVeinObjRef.Reset(); OreVeinObjRef.OnReset(); I'm not sure why you need to call OnReset, but it seems that you do. Now, if you want to use a management script that runs through a FormList filled with Ore Vein ObjectReferences and resets all of them, here you go: Scriptname OreVeinResetter extends Quest FormList property OreVeinList auto; int property DaysToRespawn = 10 auto; event OnInit() RegisterForSingleUpdateGameTime(DaysToRespawn); endEvent event OnUpdateGameTime() int i = OreVeinList.GetSize(); while (i > 0) i -= 1; (OreVeinList.GetAt(i) as ObjectReference).Reset(); (OreVeinList.GetAt(i) as ObjectReference).OnReset(); endWhile RegisterForSingleUpdateGameTime(DaysToRespawn); endEvent Keep in mind that the above code will run every x days, regardless of when you last visited the location. And depending on your specific needs, you may want to go about this a different way.
  3. Rigging and exporting meshes in Blender 2.7

    If a mesh has a BSDismemberSkinInstance, it has partitions; if it has an NiSkinInstance, it does not. Either of these will contain vertex groups corresponding to the bones of the rig. But if it has partitions, those will also be treated as vertex groups in Blender. Typically, every face of your mesh is assigned to exactly one partition, with a weight of 1. This is in addition to being assigned to some number of bones with varying weights (which typically add up to 1). The partitions are usually used for hiding the underlying skin when armor is worn over that body part. I think they are maybe used for decapitation too. In any case, to make sure everything runs smoothly I just keep it consistent with the creature whose skeleton I'm using.
  4. Writing Papyrus scripts in a dedicated code editor can be much easier than writing it in the CK for a variety of reasons. Here's how you can set up a Papyrus environment in Notepad++. This assumes you've already extracted your Scripts.rar archive. (Otherwise you can't compile even in CK!) If you're on Special Edition, you'll need slightly modified versions of the scripts, which I've listed at the bottom. Compiling Part A. Edit your Batch file 1) Make a copy of ScriptCompile.bat in your "...\Skyrim\Papyrus Compiler" folder. (Just select it, hit Ctrl+C, then Ctrl+V.) 2) Open ScriptCompile.bat in a text editor such as Notepad. (Right click the file, Edit, and if it asks you to pick a program, find Notepad.) 3) Replace the text of the file with this: "%~dp0PapyrusCompiler" %1 -f="TESV_Papyrus_Flags.flg" -i=%2;%3;%4;%5;%6 -o=%2\.. pause It needs to be exact, so copy and paste. 4) Save (Ctrl+S) Part B. Create a Notepad++ keboard shortcut. 1) Copy and paste the following command into any text editor: "{Skyrim path}\Papyrus Compiler\ScriptCompile.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)" "{Skyrim path}\Data\Scripts\Source" 2) Replace the two places where I've written {Skyrim path} with, you guessed it, your Skyrim path. Don't keep the {}. 3) OPTIONAL: If you have any other source paths you need, for example if you have PapyrusUtils or SkyUI installed in a separate location and you need those functions in your scripts, you can add up to 3 additional paths at the end of that command. 4) In Notepad++, go to Run->Run. Paste in your modified command. Click "Save..." 5) Name it "Papyrus" then select a keyboard shortcut. I use Alt+P, so I check the box for Alt and then use the dropdown menu to find P. 6) Test it out! Open a Papyrus file and hit Alt+P. You should get a window with confirmation that it compiled successfully. The window disappears as soon as you hit a key. Syntax Highlighting 1) Download this file: papyrus_definitions_skse.xml Credit goes to Cdcooley for this file. I got it from here: https://www.creationkit.com/index.php?title=User:Cdcooley/Notepad%2B%2B_Papyrus_Syntax_Highlighting In addition to general syntax highlighting for Papyrus, it highlights any SKSE functions with a different color than vanilla functions, making it easy to tell if a script has a dependency. You can find other custom Papyrus definitions here: https://www.creationkit.com/index.php?title=Notepad%2B%2B_Setup#Setting_up_Papyrus_Language_Definitions 2) In Notepad++, go to "Languages->Define your language..." 3) Then click Import and find the file you downloaded. 4) Then click Save As and type Papyrus. 5) Then, while you have a .PSC file open, go to Languages and select Papyrus. Everything should now be highlighted by syntax, and it will remember these settings whenever you open a PSC file! =================================================== ON SPECIAL EDITION: You must use these modified versions of the commands, since SE's Source files are in a different location. ScriptCompile.bat: "%~dp0PapyrusCompiler" %1 -f="TESV_Papyrus_Flags.flg" -i=%2;%3;%4;%5;%6 -o=%2\..\..\Scripts pause Notepad++ command: "{Skyrim SE path}\Papyrus Compiler\ScriptCompile.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)" "{Skyrim SE path}\Data\Source\Scripts" Again, replace {Skyrim SE path} with your path.
  5. Rigging and exporting meshes in Blender 2.7

    Can you upload your .blend file and the exported .nif? I might have time to look at it tonight.
  6. Rigging and exporting meshes in Blender 2.7

    Okay, after doing that, if you look in the object tree, do you see the mesh showing up as a branch of the appropriate object? And you have weights? Also, are you checking for NiSkinInstances also? Some creatures aren't supposed to have any body partitions so they use skins instead of dismembers.
  7. Rigging and exporting meshes in Blender 2.7

    Are you sure you parented the mesh to the skeleton in blender?
  8. Rigging and exporting meshes in Blender 2.7

    Special topic: editing weights for rigid protrusions (spikes etc) When adding objects such as spikes that protrude from the body of a creature/armor, you will usually want those protrusions to be rigid. That is, you don't want the spike to bend around as the creature animates. The entire spike should animate together as a single unit. Since only the base of the spike is attached to the creature, when the base of the spike moves, the tip of the spike should move along with it. Unfortunately, when using the Weight Transfer tool to automatically rig the protrusions, they will often have different weights assigned at different sections of the protrusion, causing it to bend as the creature animates. This must be fixed manually. Step 1. Use the Transfer Weight tool (see post above) to transfer weights from the body of the creature to the new protrusions (must be two separate objects in blender). You will probably see that each protrusion has a variety of weights (colors): Step 2. Open the spike mesh in Edit mode. Select all vertices for a single spike. If the spikes aren't connected you can do this easily: select one vertex, then hold Ctrl and hit Numpad+ a few times. Step 3. Open the spike mesh in Weight Paint mode. Enable the option for Vertex Selection Masking. You should see yellow dots on the object you selected, and black dots everywhere else. Step 4. Using the Vertex Groups section found in the Data tab, find all bones that are effecting this protrusion (any color other than the darkest blue, anywhere on the spike). I suggest using the arrow buttons to organize them so that they are all next to each other in the list. Step 5. For one bone, set the weight of all selected vertices. You can type any weight into the area where it says "Weight:", then click Assign. But how do you know what number to type? This takes some trial and error: 5a. Look at the area where the spike meets the creature's skin. The color found here is the color you want. There may be some small range of colors in the area where the two meet, if so just choose an average color for this area. (If there is a wider range of colors this technique might result in some "sliding" when animated -- see the Sliding Fix below.) 5b. Give a guess for the number value of this color (Blue = 0, Teal = 0.25, Green = 0.5, Yellow = 0.75, Red = 1.0). Assign that value while watching the edge of the spike closely. 5c. If your guess was wrong (the color at the edge between spike and skin changes), hover your mouse over the render window and hit Ctrl+Z to undo the change. Type another number and try again. Repeat until you find an optimal weight. After a successful Step 5, the spike's weight should blend perfectly where it connects to the skin, then maintain that exact color for the length of the spike: (To get this view, I'm merging the two meshes with Ctrl+J then viewing in weight mode. Then undo the merge with Ctrl+Z.) Step 6. When you're satisfied that the weighting for that bone on this spike is good, proceed to the next bone that is effecting this spike and repeat Step 5. Step 7. When this spike is appropriately rigged to ALL bones that effect it, choose another spike and repeat Steps 2-6. The final result should look like this: Sliding Fix Now, as mentioned in Step 5a, there will sometimes be a "sliding" effect if you completely rigidify a spike that had a wide range of bone weights at its base. The spike will stay solid while the flexible skin underneath it moves in various directions, giving the appearance that the spike is not attached to the skin. In these cases, you may want to leave the vertices near the skin with their initial weights from the Weight Transfer tool, and only edit the weights for vertices that don't directly touch the skin. In Step 2, just only select the vertices that are far from the surface of the skin, then proceed like normal. Here you can see that I only selected the 7 farthest vertices of this spike and left the remaining vertices untouched: That's it! Once you've edited all of your protrusions, your model should be ready for export!
  9. Rigging and exporting meshes in Blender 2.7

    Thank you Hannes! You covered most of the screenshots I wanted to add, here's just one more for the Weight Transfer Tool:
  10. At the request of some users on the AU discord, here is a dump of all the info I've learned about using Blender 2.7 for rigging and exporting rigged meshes. It probably includes a lot of info applicable to working with rigged meshes in general too. I've tried to describe most of my workflow and list the common issues that I've encountered. I might flesh it out in the future, including screenshots. Disclaimer: This is just what I did, there might have been new updates that make this unnecessary. But I know this works so I'm sticking with it for a while. =Software= Blender: 2.78c Niftools: 2.6.0 dev 4 from 7/30/2018 (must be the 2018 file -- a previous 2016 release had same version number!!) The modified Niftools files attached to this post (Note: This contains one fix for an issue during export after importing multiple Nifs, and another issue where unassigned polygons aren't selected after a failed export.) Nifskope =Install= 1. Install Blender 2. Install NifTools 3. Copy the modified niftool files into the following directory, so they overwrite the originals: %AppData%\Blender Foundation\Blender\2.78\scripts\addons\ =First notes= -As a beginner's rule of thumb, your mesh needs to be roughly the same shape (and position) as the vanilla model whose skeleton you're using. With practice you'll learn where you can and can't deviate from the base shape. -You need to work with meshes from Oldrim/Legendary Edition. SPECIAL EDITION MESHES WILL NOT WORK. You can convert your finished mesh to SE format with SSE Nif Optimizer. =Rigging & Partition notes= -To transfer rigging weights from an imported vanilla mesh to a custom mesh, load them both and make sure they're both parented to the same skeleton. Then while in Object mode right click the vanilla mesh, then Shift+ right click the new mesh, then go to Weight Paint mode. At the bottom of the Tools section you will see "Transfer Weights", run that with these options: Vertex Mapping: Nearest Face Interpolated, Source Layers Selection: By Name. -After transferring weights you can adjust them in Weight Paint mode. You need to have the display mode set to Solid to be able to see these values. Then choose a vertex group in the Data tab to see/edit the weighting of that bone. -If you're using Normalize or Auto-Normalize when painting weights, you'll need to first remove all vertices from any Partition vertex groups. Otherwise the normalization will ruin everything. These groups will be called things like SBP_32_BODY. Use the Data tab to Assign them back to the appropriate groups after you're done painting weights. If you don't add them back, the mesh will be exported with a NiSkinInstance instead of a BSDismemberInstance. (Some creatures don't use partitions, and therefore always have a NiSkinInstance. That's fine.) For the creatures I've worked with, there has been at most 2 partitions, so I just make sure to only weight paint on vertices from one partition (selection masking can help here) at a time so I don't accidentally put any in the wrong partition afterwards. -Sometimes those partitions are split up on an imported mesh, into SBP_32_BODY.002 etc. In those cases, combine them using Assign and delete the numbered groups. -If you get an export error about some faces not being assigned to any body part partitions, it will select those faces for you (if you have the correct 2018 versions of everything). Sometimes it may seem like everything is appropriately added to body parts, but there can be issues with the vertices along the edges of neighboring body parts. Every face should belong to exactly one body part. However, if two faces that are part of different body parts share a vertex, that vertex must be assigned to BOTH body parts. This means you can't, for example, select all of the faces in the HEAD body part and then Remove them from the BODY body part, since this will remove all the shared vertices too. -You'll get corrupted rigging if the object's Transform settings are incorrect for that skeleton. You can use Ctrl+A to apply any existing transforms, then go to the Object tab and type in the opposite (negative) of the correct transforms (look at an imported vanilla mesh), apply those, then finally type in the correct transforms to restore it to the correct position with the correct values. Do NOT apply those last correct transforms, just leave them as numbers in the Object tab. If it's supposed to be all 0's, just applying the existing transformations will be enough. =Export notes= -When exporting, be sure to choose Game: Skyrim and Max Partition Bones: 60. I also always check "Flatten Skin" but I don't know if that's actually necessary. Otherwise the default import and export settings have always worked for me. -You can easily run into problems with the settings in the Object tab, Data tab, Material tab, and Texture tab. If you get an error/issue and you don't know what it is, the best approach is to compare all of the settings in those tabs to a vanilla mesh. =Nifskope (post-export) notes= -After export, I recommend splicing the vertex data and rigging data into a vanillla nif that uses the same skeleton. They must have the same string name on the Root node, then you can copy the NiTriShapeData and paste at end, then for the BSDismemberSkinInstance (or NiSkinInstance) copy branch and paste at end. Remember their new node numbers. Then find the NiTriShape you're replacing and enter those numbers into the Data and Skin Instance slots. -You can also run Copy Branch on an entire NiTriShape node after changing the Root name if the vanilla nif didn't have enough NiTriShapes. After pasting at end, go to the root node, increase Num Children by 1, double click the green refresh symbol below it, then expand the list of children. At the end should be a None, change this to the number of your new NiTriShape. -I've also found that the splicing only works correctly if the NiTriShapes are not children of any NiNode other than the 0 root node at the time of copying. -After splicing in your data, you can adjust the BSLightingShaderProperty and its BSShaderTextureSet (I avoid using the BSLightingShaderProperty exported by Blender but do as you will). -BSDismemberSkinInstances will sometimes not have the Part Flags "PF_EDITOR_VISIBLE" and "PF_START_NET_BONSET" which are necessary for rigging in-game. If you are getting bizarre deformations when the mesh animates but they look fine in Nifskope, be sure to check this. Toggle these on all partitions for each BSDismemberSkinInstance inside Nifskope. I haven't been able to set these from Blender. niftools-2.6.0-dev4-2018-modifications.zip
  11. Blender 2.7+ Nif Exporter Tutorial

    I was able to get Blender 2.7 working with armatures! Based on the advice here: http://niftools.sourceforge.net/forum/viewtopic.php?f=21&t=6504 Blender 2.78c NifTools 2.6.0 Dev 4 (from June 18th 2016) 1) Install Blender and the NifTools plugin (through Blender's addon manager). Exit Blender. 2) Navigate to the addon folder: %AppData%\Blender Foundation\Blender\2.78\scripts\addons\ 3) Apply the changes found here: https://github.com/niftools/blender_nif_plugin/pull/252/files - At the top of each change is a filepath. Find the file at that path within the addon folder. Open with Notepadd++ or something. - Remove any lines shown in red. Add any lines shown in green. Don't include the + at the beginning of the line. 4) Apply the changes I describe here (second comment): http://niftools.sourceforge.net/forum/viewtopic.php?f=21&t=6700&p=32976#p32976 New site, here's the link: https://forum.niftools.org/topic/4487-bonesvertex-groups-named-incorrectly-after-export-fixed/?do=findComment&comment=29890 Just in case it goes down again, here is the text: "In file io_scene\nif_common.py In function get_bone_name_for_nif Replace: name = name.replace("NPC ", "NPC L") With: name = name.replace("NPC ", "NPC L ") This should be on two lines (176 and 181 for me)." And that's it for the install. Be careful about applying transformations before export as described in the original post, that can have bizarre effects on armatures which are quite difficult to fix. When exporting the armature, I think you will need to check the Flatten Skin box and set Max Partition Bones to 60. But I'm not 100% sure about that And if you're going to use it in Skyrim Special Edition, you will want/need to run it through SSE Nif Optimizer. One problem that I've seen: After exporting, there may still be issues with the skeleton losing its rotation values. I've only seen this happen when multiple meshes were imported into a single Blend file (but even when doing this it won't always have a problem). This also effects the NiSkinInstance so if your mesh needs custom bone weights, I don't know how to fix it I've had some luck with copying the mesh components into separate blend files before exporting. But if you've only moved vertices around, without adding or deleting any new vertices and without changing the vertex groups, then you can just splice the new NiTriShapeData into the old mesh. I'm not sure what exact circumstances cause this issue since I haven't had problems combining meshes in the past.