Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
139 views
in Technique[技术] by (71.8m points)

Read and manipulate objects from another module [Python + Maya]

Thank you for your patience, I'm not a great coder but I would try to do my best simplifying all my rigging stuff. I searched everywhere on the net, if I'm asking right now it's because I clearly can't understand somewhat.

I'm creating an auto-rigger tool and I'm declaring some curves in main.py. Actually I created a particular curve with more than seventy CVs and so, in main.py, I have this thing long about twenty rows. Navigate what I wrote is becoming awful. So, for now, I want to have a better order moving this object in another module called UI_library.py.

In UI_library.py I declared some function to access my clavController object.

.../UI_library.py

def createClav():
        clavController = cmds.curve(d=1, p=[coordinates])

In main.py I call the func.

.../main.py

import UI_library as libs
clavController = libs.createClav()

The newClav curve is generated in my Maya scene and when I execute

print(newClav) 

The result is none and at this point I'm stuck because I can't use the curve I built

Should I create global var between files? Learn and use classes? I thought this would be a simple work of "translation". Thank you again

question from:https://stackoverflow.com/questions/65849750/read-and-manipulate-objects-from-another-module-python-maya

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...