通过Python在Maya中导入动画会产生奇怪的结果

时间:2015-08-24 23:04:34

标签: python animation maya quaternions maya-api

我正在尝试为游戏引擎构建和重建一种格式,并且在尝试将其放回Maya时会产生奇怪的结果。

这不是真正的错误或任何类型,但动画的结果很奇怪。

我真的需要在 ERROR com.xerox.implteam.devrox.client.dao.impl.AccountDAOImpl - java.sql.SQLException: ORA-00904: "ACCOUNT_NUMBERIKE": invalid identifier Query: SELECT DISTINCT ACCOUNT_KEY, ACCOUNT_NUMBER FROM V_ACCOUNT WHERE ACCOUNT_NUMBER like ? order by ACCOUNT_NUMBER asc Parameters: [34%] at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:363) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:350) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:288) at com.xerox.implteam.devrox.client.dao.impl.AccountDAOImpl.getAccountSearchBeanByLikeAccountNumber(AccountDAOImpl.java:55) at com.xerox.implteam.devrox.client.bo.AccountBO.getAccountSearchBeanByLikeAccountNumber(AccountBO.java:41) at com.xerox.implteam.devrox.client.controllers.AutoCompleteController.preparePageModel(AutoCompleteController.java:43) at com.xerox.infrastructure.addon.impl.runtime.addonServlet.handleGetPage(addonServlet.java:207) at com.xerox.infrastructure.addon.impl.runtime.addonServlet.handlePage(addonServlet.java:173) at com.xerox.infrastructure.addon.impl.runtime.addonServlet.service(addonServlet.java:96) at javax.servlet.http.Httimplteamervlet.service(Httimplteamervlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.tabs.TabsFilter.doFilter(TabsFilter.java:40) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.virtualFS.VirtualFileSystemFilter.doFilter(VirtualFileSystemFilter.java:72) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.security.csrf.web.CsrfGuardFilterProxy.doFilter(CsrfGuardFilterProxy.java:38) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at com.xerox.infrastructure.authentication.ProdSecurityEnforcementFilter.doFilter(ProdSecurityEnforcementFilter.java:157) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.acegisecurity.context.HttimplteamessionContextIntegrationFilter.doFilter(HttimplteamessionContextIntegrationFilter.java:249) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.http.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.security.BrowserSecurityFilter.doFilter(BrowserSecurityFilter.java:69) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.cache.NoCacheFilter.doFilter(NoCacheFilter.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.http.RequestResponseFilter.doFilter(RequestResponseFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.encoding.MultilingualSupportFilter.doFilter(MultilingualSupportFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xerox.infrastructure.config.StartupErrorFilter.doFilter(StartupErrorFilter.java:67) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:662) 格式中以引擎的形式使用它,因为它比Quaternion更好地处理它,但是当尝试将它应用于Maya时我找不到适当的方式。

这就是我的工作,因为我无法真正找到直接应用Euler axis的方式:

Quaternion

结果如下:

Walking anim

你可以看到它很容易分辨出动画的作用但是你可以看到那些手臂或腿之间飞行了一会儿的怪异帧,并且通常会搞乱整个动画。

我认为这是因为我使用代码进行的转换数据丢失。我基本上对arot_count = struct.unpack( "<L", f.read( 4 ) )[ 0 ] # Reads the number of animation frames for i in range( 0, arot_count ): keytime = ( struct.unpack( "<L", f.read( 4 ) )[ 0 ]/80 ) # Keyframe arot = om.MQuaternion( struct.unpack( "f", f.read( 4 ) )[ 0 ], struct.unpack( "f", f.read( 4 )[ 0 ], struct.unpack( "f", f.read( 4 ) )[ 0 ], struct.unpack( "f", f.read( 4 ) )[ 0 ])# Reads quat from file narot = arot.normal() # Normalizes the quaternion rot = narot.asEulerRotation() # Converts it to euler angles if isMesh == False: cmds.setAttr( ( obj.name + ".rotate" ), rot.x * 180 / math.pi, rot.y * 180 / math.pi, rot.z * 180 / math.pi ) cmds.setKeyframe( obj.name, time = keytime ) 进行了规范化(实际上没有任何效果,因为它给出了相同的结果,但很多人建议),然后我将它从Maya API转换为Quaternion角度,然后我只是通过了具有良好旧数学的弧度,但这似乎不太合适,可能是文件丢失数据的结果。

我想知道是否有更好的方法在关键帧中应用旋转,我会非常感激。

提前致谢。

1 个答案:

答案 0 :(得分:0)

您可以尝试在动画角色上运行maya Euler Filter;由于四元数到欧拉转换不是确定性的,你不能确定一帧的eulerization与下一帧的eulerization相同,插值是古怪的。

https://www.youtube.com/watch?v=zo0xhw1B2dE