def aFunc(arg, arg2, arg3):
return arg + arg2 + arg3
# aModule.py
def aFunc(arg, arg2, arg3):
return arg + arg2 + arg3
# main.py
import aModule
aFunc(1,2,3)
# conf.py
class Config(object):
def __init__():
self.number = 1
self.name = "Name"
DefaultConfig = Config()
# main.py
import conf
def main(config):
pass
def doWithDefaults():
number = conf.DefaultConfig.number
name = conf.DefaultConfig.name
# ...
if __name__ == "__main__":
# ... parse command args ...
config = conf.Config()
config.number = parsedNumber
config.name = parsedName
main(config)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ee3e0a6f-f3dc-4cbe-a99d-4b69fa7cd722%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
hi Justin,
sorry let me explain more clearly. I have a package which contains 3 modules (seperate python files) and a subpackage which contains all the utility modules (6 other python files, like 'subdivide_curves' and 'fire_circles' etc).
in the main package the 3 modules 'createGui' which loads my GUI, one 'configure' which sets up all the required variables for my program and another 'run' which actually gets called when the user runs the program through the GUI.
Inside 'run' it basically has all of my modules loaded in (that are being used directly in 'run' like this:
-------------------------------------------
import samDev.rigging.TOPOCOAT.configure as configure
reload(configure)
import samDev.rigging.TOPOCOAT.utility_functions.subdivide_curves as subdivide_curves
reload(subdivide_curves)
import samDev.rigging.TOPOCOAT.utility_functions.general as general
reload(general)
import samDev.rigging.TOPOCOAT.utility_functions.webbing as webbing
reload(webbing)
import samDev.rigging.TOPOCOAT.utility_functions.circle_configure as circle_config
reload(circle_config)
---------------------------------------
and then there is a main function which just calls the required modules one after the other using the variables returned from the 'configure' module.
eg. 'subdivide_curves.execute(configured_curves)'
The problem i think when a module is called which then itself creates new variables (specific to that module) and calls another module and i have to track the current variables' state at that point and feed those modified variables into the module call.
Like inside the module 'circle_configure' the script calls the module 'general' which has a function that fires rays and return collision points. but before it calls it i have to figure out all the variables it requires from the 'subdivide_curves' module and feed them into the module call:
fire_circles.execute(circle_counter,limb_counter,curr_circ_center,limb_vec,crv_pnt1,crv_pnt2)
when this was all one script everything linked up obviously. But as im splitting things up im finding it tedious to feed information from one module into the next one. And im not sure if im setting this up sensibly.
I hope this is clearer? sorry am a bit lost here
thanks alot Justin,
Sam
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/193f7cdf-2348-4071-b934-8dcb826a9685%40googlegroups.com.
fire_circles.execute(circle_counter,limb_counter,curr_circ_center,limb_vec,crv_pnt1,crv_pnt2)
Then use the collisionPoints variable as the argument in the call to the next module in my script?loft_surfaces(collisionPoints)?this is what i mean by keeping track of the variables and passing them onto the next module. Maybe its fine and this is what i need to be doing, but i just wanted to be sure on itthanks,Sam
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/SvBxVxv7uog/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0yx74NaTzj3imyXVn4AdXJ6S6qyU1vpx6d2XKCdWGJyw%40mail.gmail.com.
thanks Justin,so inside the configure module, which you help me setup a few weeks ago. is the class which sets up all the variables and then returns just the class instance which contains all the variables as one keyword right? like:'attribute.limb_num''attribute.curve_num''attribute.current_surface'so then i can just return 'attribute' to the main 'run' script. and these initialised variables get used throughout the script.so in my 'run' module there is a call to another module 'circle_configure', using the returned 'attribute' variables from the 'configure' module. This module which deals with creating circles for lofting geometry for the fingers of my character. Inside the 'circle_configure' module there is a bunch of code which creates new variables that are specific to the current finger that the script is working on (there is a loop which goes through each finger in the character), like 'circle_num' or 'crv_pnt1' and ''limb_vec' etc. This information is created for the current finger and then i need to send this newly created info to the module which fires rays and returns collision points on the mesh of my character.fire_circles.execute(circle_counter,limb_counter,curr_circ_center,limb_vec,crv_pnt1,crv_pnt2)is this the correct way to use the call to another module within a module. Just send it the required variables as arguments? and then return values from that module and store it in a new variable like:collisionPoints=fire_circles.execute(circle_counter,limb_counter,curr_circ_center,limb_vec,crv_pnt1,crv_pnt2)Then use the collisionPoints variable as the argument in the call to the next module in my script?loft_surfaces(collisionPoints)?this is what i mean by keeping track of the variables and passing them onto the next module. Maybe its fine and this is what i need to be doing, but i just wanted to be sure on it
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CA%2BGceHXc9haohTfbA-8yDPWTL5NQcjPP6ZD3o-L9byUsNmenAw%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/SvBxVxv7uog/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ba277fa5-06d4-4e59-91c0-4700e275d8d4%40googlegroups.com.
i had already done this for a few variables like you show me before. But is it weird to initialise every variable used throughout the script in a config module?
On 19 June 2016 at 22:13, <s...@weacceptyou.com> wrote:i guess i can just go through my script and find all the created variables and put them all in the config module. So i can store all my variables under one object name. Then i would only need to reference that one object for access to any variable i needed.
is this sort of what you're saying?
thanks,
Sam
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/SvBxVxv7uog/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
--To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ba277fa5-06d4-4e59-91c0-4700e275d8d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CA%2BGceHUaybqRjxdbtnj55y2gqz2s0%2BtWEPK0kYd_6PKHg-DR%3Dg%40mail.gmail.com.