2021-07-13xulie
# coding=utf-8
import os
import jsonfrom pyfbsdk import *global allNodesdef getBranchObj(topModel):'''递归获取所有的对象:param topModel::return:'''global allNodesfor childModel in topModel.Children:getBranchObj(childModel)jointName = str(topModel.LongName).split("_")[-1]allNodes[jointName] = topModeldef getTopModel(model):if model.Parent.LongName == "Vicon:Optical":return modelelif not model.Parent:return Nonefor parentModel in model.Parent:getTopModel(parentModel)def createCharacter():'''为vicon骨骼创建角色:return:'''global allNodesviconGrp = FBFindModelByLabelName("Vicon:Optical")if not viconGrp:returnselectedModels = FBModelList()FBGetSelectedModels(selectedModels, None, True, True)if selectedModels:foundComponents = list()for model in selectedModels:ns = model.LongName.split(":")[0]temp = FBComponentList()FBFindObjectsByName('%s:*_Hips' % ns, temp, True, True)for unit in temp:if unit:foundComponents.append(unit)foundComponents = list(set(foundComponents))else:foundComponents = FBComponentList()includeNamespace = TruemodelsOnly = TrueFBFindObjectsByName('*:*_Hips', foundComponents, includeNamespace, modelsOnly)for comp in foundComponents:if not comp:continueallNodes = dict()getBranchObj(comp)if not allNodes:continuenamespace = allNodes.values()[0].LongName.split(":")[0]pCharacterName = namespacematchSkeFromPreset(allNodes.values())characterizeSkeleton(pCharacterName, allNodes)# lScene.Evaluate()def characterizeSkeleton(pCharacterName, pSkeleton):'''定义fb角色:return:'''if FBApplication().CurrentCharacter and FBApplication().CurrentCharacter.LongName == pCharacterName:return# Create a character.character = FBCharacter(pCharacterName)FBApplication().CurrentCharacter = characterfor jointName, joint in pSkeleton.iteritems():slot = character.PropertyList.Find(jointName + 'Link')if slot is None:continueslot.append(joint)# character.SetCharacterizeOn(True)# character.CreateControlRig(True)character.ActiveInput = Nonedef getXtoolDir():'''获取xtoolDir路径:return:'''xToolDir = NoneconfigPath = FBSystem().UserConfigPathxToolPath = os.path.join(configPath, "PythonStartup", "xToolConfig.txt").replace("\\", "/")with open(xToolPath, "r") as f:for unit in f.readlines():if unit.strip().startswith("#"):continueif os.path.exists(unit.strip()):xToolDir = unitbreakreturn xToolDirdef matchSkeFromPreset(allNodes):'''匹配骨骼从预设的pose值:return:'''if not allNodes:returnxtoolDir = getXtoolDir()with open(xtoolDir + "/Files/MacapPresrtSke/standard_pose_macap.json", "r") as f:allContent = json.loads(f.read())lScene = FBSystem().Scenefor unit in allNodes:if str(unit.__class__) == "<class 'pyfbsdk.FBModelSkeleton'>":for key, value in allContent.items():if unit.LongName.endswith(key):globalRotation = FBVector3d(value[0], value[1], value[2])# 设置对象的全局坐标unit.SetVector(globalRotation, FBModelTransformationType.kModelRotation, True)break# createCharacter()
2021-07-13xulie相关推荐
- 哔哩哔哩“2021.07.13 我们是这样崩的”报告的学习-1
哔哩哔哩"2021.07.13 我们是这样崩的"报告的学习-1 这份报告是我学计算机两年来第一次真实看到大厂的员工到底在干什么.出现了很多专有名词,以及当前最先进的互联网企业的应用 ...
- 2021.07.22禾赛提前批一面面经
2021.07.22禾赛提前批一面面经 1.LUTRAM的意思 2.LUTRAM和block RAM的区别 3.时序约束和时序优化 4.跨时钟域 5.为什么不能多bit采用同步寄存器打两拍(就这个问题 ...
- 2021.07.07 宇信科技
2021.07.07 宇信科技 宇信科技 晚上电话面 问了一堆java基础,离谱,jd上也没要求java:简历筛选扣工资! java小白,凭借c语言基础简单回答了一哈,面试官估计在电 ...
- Doris Weekly FAQ】2021.07.19~2021.08.01
观众朋友们: 晚上好! 欢迎收看[ Doris 近日要闻]~本次为您带来的是 2021年07月19日 - 2021年08月01日 的双周总结. Doris 社区周报每期会包含 FAQ 环节.我们会在社 ...
- 【Doris Weekly FAQ】2021.07.05~2021.07.18
观众朋友们: 晚上好! 欢迎收看[ Doris 近日要闻]~本次为您带来的是 2021年07月15日 - 2021年07月18日 的双周总结. Doris 社区周报每期会包含 FAQ 环节.我们会在社 ...
- Ubuntu下载安装EDB1.3.0 2021.07
Ubuntu16.04x64下载安装EDB1.3.0 2021.07 1.更新gcc和g++ > 7 $ sudo add-apt-repository ppa:ubuntu-toolchain ...
- 新手如何理解一个Web应用的构建(2021.07.29更新)
Web应用构建 ==前言== 我为什么写这篇文章? 适合什么样的人看? ==摘要== 步骤汇总 (1)网站定位与功能设定 (2)信息架构 (3)UI设计 (4)应用架构 (5)开发 (6)部署 (7) ...
- 使用Go开发的数字书架应用 | Gopher Daily (2021.07.05) ʕ◔ϖ◔ʔ
每日一谚:API consumers: if it is not part of the contract, don't depend on it. Go技术生态 Myreads:一个使用Go.Rea ...
- 2021.07.16 总结
2021.07.16 总结 今天状态不怎么好,几道那么容易的题就只有140分,毕竟也就打了前两道 T1 花生采摘 题目描述 鲁宾逊先生有一只宠物猴,名叫多多.这天,他们两个正沿着乡间小路散步,突然 ...
- 2021.07.16【普及组】模拟赛C组
2021.07.16[普及组]模拟赛C组 文章目录 2021.07.16[普及组]模拟赛C组 前言 花生采摘 题目 解析 代码 FBI树 题目 解析 代码 火星人 题目 解析 代码 麦森数 题目 解析 ...
最新文章
- Ansible 基础-介绍
- Netflix 如何使用机器学习来提升流媒体质量
- Java内存模型深度解析:顺序一致性
- 开平推进智慧城市等领域信息化建设及公共数据资源共享
- jsoup: Java HTML Parser
- 语音识别的原理_语音识别原理_语音识别原理框图 - 云+社区 - 腾讯云
- 【279天】每日项目总结系列017(2017.11.11)
- 时间管理——四象限法则
- c语言编程 消除直线锯齿,C语言 抗锯齿像素渲染
- 继续教育计算机组成试卷,计算机继续教育考试模拟练习.doc
- android 播放器封装,Android基于IJKPlayer视频播放器简单封装设计
- 虚拟存储管理+地址变换+软考系统架构设计师
- photoshop cs6用户界面字体太小的解决方案
- uva 10158 - War(并查集)
- 变量相关性分析(决策变量和目标函数之间的关系-决策变量可加可分离性)
- 嵌入式应用软件任务划分的原则
- Lasso-Logistic回归-R语言应用详解
- v-if和v-for的优先级
- C# Get和Post
- 从14次“一轮游”到问鼎大满贯 “灰姑娘”张帅这样逆袭