Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Auto import module
  RSS 2.0 ATOM  

Auto import module
Rate this thread
 
9199
 
Permlink of this thread  
avatar
  • Total Posts: 9
  • Joined: 25 August 2006 08:19 AM

Hi

Is there a way to automatically import custom made module in motion builder.

Thanks



Replies: 0
avatar
  • KxL
  • Posted: 26 February 2008 07:02 PM

What you call by module ?



Replies: 0
avatar

well im in a Python forum so im talking about a python script in which there are defs that i can call to simplify the python commands

ex:

in my script (module) defs.py

from pyfbsdk import FBModelList,FBGetSelectedModels

def selection
():
    
modelList FBModelList()
    
FBGetSelectedModelsmodelList )
    
    if 
len(modelList) == 0:
        return 
None
    
else:
        return 
modelList

if i type in the python console

from defs import *

i can then type selection() and get what is selected

The weird thing about motion builder is that it DOES import my “defs” module at startup but it doesnt keep it in the globals() of the python shell.

any solution to that



Replies: 0
avatar
  • KxL
  • Posted: 27 February 2008 09:58 AM

well I like to be sure before I answer. Hope it didn’t offend you.

I have check and it looks like that import is hard coded in MB python console.

Cheers



Replies: 0
avatar

so in other words there is nothing i can do…



Replies: 0
avatar

Same problem here…

I want to transfer a shelf-like UI tool to Motionbuilder 2012. Every tab is a separate module, but I run in the same problem as Pierre-Marc.

By the way, I got the code from an example by Naiqi Weng last week during an Autodesk class, so there must be a way to make that work.



Replies: 3
/img/forum/dark/default_avatar.png

Well, it seems Mobu 2012 wants us to put our modules here:
C:\Program Files (x86)\Autodesk\MotionBuilder 2012 (32-bit)\bin\config\Python
instead of
C:\Users\jsimard\Documents\MB\2012\config\Python
It works now.

Author: Jonathan Simard

Replied: 11 October 2011 03:37 AM  
/img/forum/dark/default_avatar.png

Well, it seems Mobu 2012 wants us to put our modules here:
C:\Program Files (x86)\Autodesk\MotionBuilder 2012 (32-bit)\bin\config\Python
instead of
C:\Users\jsimard\Documents\MB\2012\config\Python
It works now.

Author: Jonathan Simard

Replied: 11 October 2011 04:44 AM  
/img/forum/dark/default_avatar.png

Damned refresh…

Author: Jonathan Simard

Replied: 11 October 2011 04:45 AM