Skip to content

Instantly share code, notes, and snippets.

@Neill3d
Neill3d / gist:0fefbc962f13fc5999838dcbf8e9ff34
Created March 20, 2024 22:18
go frame by frame with a viewport refresh
from pyfbsdk import*
global i
global my_system
i = 0
my_system = FBSystem()
# go to next frame until finished
def OnIdleEvent(control, event):
@Neill3d
Neill3d / exportRegions.py
Created July 4, 2023 15:24
from selected original mesh and small region meshes, export every region vertex and nearest original mesh projected details
# script to export projected points
import maya.OpenMaya as om
import maya.cmds as cmds
import maya.OpenMayaAnim as omAnim
import inspect
# select canonical mesh and region meshes
@Neill3d
Neill3d / exportSkinWeights.py
Created July 4, 2023 15:18
write in a text file influences and skin binding weights of a selected poly mesh
import maya.OpenMaya as om
import maya.cmds as cmds
import maya.OpenMayaAnim as omAnim
def getSkinCluster(dag):
"""A convenience function for finding the skinCluster deforming a mesh.
params:
dag (MDagPath): A MDagPath for the mesh we want to investigate.
"""
@Neill3d
Neill3d / createMarkerOnSelection.py
Created June 27, 2023 17:20
Create Marker On A Selected Bone
from pyfbsdk import*
PREVIX = "_marker"
# get selected models
models = FBModelList()
FBGetSelectedModels(models)
# we assume that first selected model is our bone
boneModel = models[0]
import traceback
import StringIO
import logging
import os, sys
from pyfbsdk import *
def print_to_hud(text):
printed = False
@Neill3d
Neill3d / gist:9f20ed65b38db1731c33942c0fe7c6b3
Created April 14, 2019 22:42
MoBu Embedded Code Device
# script is running inside the same context, so it could be splitted into initialization step and evaluation step
# here is an example
try:
initialize > 0
print "evaluating"
except (NameError,),e:
initialize = 1
print "initilize"
@Neill3d
Neill3d / gist:38ffd8cbf2f7c736554907d4b7805b77
Created July 21, 2018 15:43
Life checkers for FBModelList and FBComponentList
struct SComponentListHolder
{
public:
// a constructor
SComponentListHolder()
{
component_list = FBCreateComponentList();
}
~SComponentListHolder()
{
@Neill3d
Neill3d / gist:1a57cdca9493493b98ba59fe9aeca207
Created July 30, 2017 09:41
Binding vertex attributes from FBModelVertexData
// don't forget to check for VBO offsets
FBModelVertexData *pVertexData = pModel->ModelVertexData;
if (pVertexData == nullptr || pVertexData->IsDrawable() == false)
return false;
const unsigned int positionId = pVertexData->GetVertexArrayVBOId(kFBGeometryArrayID_Point);
const unsigned int normalId = pVertexData->GetVertexArrayVBOId(kFBGeometryArrayID_Normal );
const unsigned int uvId = pVertexData->GetUVSetVBOId();
@Neill3d
Neill3d / gist:fee0f3c4ab42f2c2f938de26a7749199
Created June 30, 2017 19:53
OR SDK: take information about blendshapes
/*
super important to initialize oriIndex variable with value like 0.
Othewise ShapeGetDiffPoint will not work and return false !!!
*/
int oriIndex=0;
FBVertex posDiff;
FBNormal normalDiff;
pGeometry->ShapeGetDiffPoint(i, j, oriIndex, posDiff, normalDiff);
@Neill3d
Neill3d / gist:eeebdb9cdf800995bb1257c35f5078e6
Created May 16, 2017 15:19
MotionBuilder FBTime GetTimeString/SetTimeString Issue
lTime = FBTime(0,0,0,-1710)
strValue = lTime.GetTimeString()
print strValue
lTime2 = FBTime(0)
lTime2.SetTimeString(strValue)
frameIdx = lTime2.GetFrame()