Exemple #1
0
    def __init__(self, factories, typename='', **kwargs):
        self.node       = self.createNode()
        self.factories  = factories
        self.type       = typename
        self.attrs      = {}
        self.children   = {}
        self.parents    = {}
        self.gui        = CRObject_GUI(self)
        self.bScript    = True

        clstypename = self.__class__.crtype.getTypeName()
        if not typename: typename = clstypename
        if Object.getInstanceQualifier() in kwargs:
            typename = kwargs[Object.getInstanceQualifier()]
        fact = self.factories.getFactory(clstypename)
        sim = fact.build(typename, **kwargs)
        self.initMembers(self.__class__.crtype, sim, prefix='default')

        if Scriptable.getTypeName() in kwargs:
            self.addScript(prefix='script', **kwargs[Scriptable.getTypeName()])

        self.rename(typename)
        CRObject.addObjToGlobalContext(self)

        pm.select(self.node)
    def test_script(self):
        scriptfile = os.path.abspath("./input/scripts/camera_script.py")
        scry = Scriptable()
        scry.scriptpath = scriptfile
        scry.function = "render"
        scry._parseModInformation()

        # cam = Camera()
        cam = RenderObject()
        cam.script = scry
        cam.geometry = [Sphere()]
        cam.render(None)
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(Simulation,self).__init__(*args, **kwargs)

        self._name = self.getMember('name')
        self._data = self.getMember(DataObject.getTypeName())
        self._robjs = self.getMember(RenderObject.getTypeName())
        self.instanced = False
        self.script     = self.getMember(Scriptable.getTypeName())
Exemple #4
0
    def updateMembers(self):
        super(RenderObject, self).updateMembers()

        self.setMember('ep1', self.ep1)
        self.setMember(Geometry.getTypeName(), self.geometry)
        self.setMember(Shader.getTypeName(), self.shaders)
        self.setMember('condition', self.condition)
        self.setMember('instanced', self.instanced)
        self.setMember(Scriptable.getTypeName(), self.script)
Exemple #5
0
    def _initMembersDict(self):
        super(RenderPass, self)._initMembersDict()

        self._members['name']                           = [str, 'pass']
        self._members[cscene.Scene.getTypeName()]       = [cscene.Scene, []]
        self._members[clight.Lighting.getTypeName()]    = [clight.Lighting, []]
        self._members[ccam.Camera.getTypeName()]        = [ccam.Camera, []]
        self._members[csett.Settings.getTypeName()]     = [csett.Settings, []]
        self._members[Scriptable.getTypeName()]         = [Scriptable, None]
        self._members[hider.Hider.getTypeName()]        = [hider.Hider, []]          
Exemple #6
0
    def __init__(self, *args, **kwargs):
        super(RenderPass,self).__init__(*args, **kwargs)

        self.name           = self.getMember('name')
        self.rndrsettings   = self.getMember(csett.Settings.getTypeName())
        self.lighting       = self.getMember(clight.Lighting.getTypeName())
        self.camera         = self.getMember(ccam.Camera.getTypeName())
        self.scene          = self.getMember(cscene.Scene.getTypeName())
        self.script         = self.getMember(Scriptable.getTypeName())
        self.hiders         = self.getMember(hider.Hider.getTypeName())
        self.renderables    = []
Exemple #7
0
    def _initMembersDict(self):
        super(RenderObject, self)._initMembersDict()

        # self._members['motionblur']     = [bool, False]
        # self._members['range']          = [intlist, [-1,-1]]
        self._members['ep1']                    = [float, 1.0]
        self._members[Geometry.getTypeName()]   = [Geometry, []]
        self._members[Shader.getTypeName()]     = [Shader, []]
        self._members['condition']              = [str, '']
        self._members['color']                  = [floatlist, []]
        self._members['instanced']              = [bool, False]
        self._members[Scriptable.getTypeName()] = [Scriptable, None]
Exemple #8
0
    def _createScriptGUI(self):
        pm.text( label='Script' ) 

        pm.attrEnumOptionMenuGrp( l='Type', 
                at=self.node.name() +
                '.'+CRObject_Node._scriptTypeAttr,
                ei=(0, Scriptable.getTypeName()),
                en=self.bScript)

        pm.button(label="Add", w=128,
                c=pm.Callback(self.addScriptGUI, prefix='script'), 
                en=self.bScript)
Exemple #9
0
    def __init__(self, *args, **kwargs):
        super(RenderObject,self).__init__(*args, **kwargs)

        self.data         = []
        self.multiobject  = False

        self.ep1        = self.getMember('ep1')
        self.geometry   = self.getMember(Geometry.getTypeName())
        self.shaders    = self.getMember(Shader.getTypeName())
        self.condition  = self.getMember('condition')
        self.color      = self.getMember('color')
        self.instanced  = self.getMember('instanced')
        self.script     = self.getMember(Scriptable.getTypeName())
Exemple #10
0
    def __init__(self, *args, **kwargs):
        super(DataSource,self).__init__(*args, **kwargs)

        self.name = self.getVar('name', kwargs)
        self.resource = self.getVar('resource', kwargs)
        self.script     = self.getMember(Scriptable.getTypeName())
Exemple #11
0
 def updateMembers(self):
     super(Lighting, self).updateMembers()
     self.setMember('filename', self.filename)
     self.setMember(Scriptable.getTypeName(), self.script)
     self.setMember(Shader.getTypeName(), self.shaders)
Exemple #12
0
 def _initMembersDict(self):
     super(Scene, self)._initMembersDict()
     self._members['filename']           = [str, 'default.rib']
     self._members[Scriptable.getTypeName()] = [Scriptable, None]
Exemple #13
0
 def __init__(self, *args, **kwargs):
     super(Visualizer,self).__init__(*args, **kwargs)
     self.script     = self.getMember(Scriptable.getTypeName())
     return
Exemple #14
0
 def updateMembers(self):
     super(Camera, self).updateMembers()
     self.setMember('filename', self.filename)
     self.setMember(Scriptable.getTypeName(), self.script)
Exemple #15
0
 def updateMembers(self):
     super(Geometry, self).updateMembers()
     self.setMember(Scriptable.getTypeName(), self.script)
     self.setMember('changingparams', self.changingparams)
Exemple #16
0
 def _initMembersDict(self):
     super(Geometry, self)._initMembersDict()
     self._members[Scriptable.getTypeName()] = [Scriptable, None]
     self._members['changingparams']         = [bool, False]
Exemple #17
0
 def __init__(self, *args, **kwargs):
     super(Geometry,self).__init__(*args, **kwargs)
     self.script     = self.getMember(Scriptable.getTypeName())
     self.changingparams = self.getMember('changingparams')
Exemple #18
0
    def _initMembersDict(self):
        super(DataSource, self)._initMembersDict()

        self._members['name']     = [str, 'default']
        self._members['resource'] = [cr_types.url, '']
        self._members[Scriptable.getTypeName()] = [Scriptable, None]
Exemple #19
0
 def _initMembersDict(self):
     super(Simulation, self)._initMembersDict()
     self._members['name']   = [str, 'sim']
     self._members[DataObject.getTypeName()] = [DataObject, None]
     self._members[RenderObject.getTypeName()] = [RenderObject, []]
     self._members[Scriptable.getTypeName()] = [Scriptable, None]
Exemple #20
0
    def updateMembers(self):
        super(DataSource, self).updateMembers()

        self.setMember('name', self.name)
        self.setMember('resource', self.resource)
        self.setMember(Scriptable.getTypeName(), self.script)
Exemple #21
0
 def _initMembersDict(self):
     super(Camera, self)._initMembersDict()
     self._members['filename']   = [str, '']
     self._members[Scriptable.getTypeName()] = [Scriptable, None]
     self._members['moving_camera'] = [bool, True]
Exemple #22
0
 def _initMembersDict(self):
     super(Visualizer, self)._initMembersDict()
     self._members[Scriptable.getTypeName()] = [Scriptable, None]
Exemple #23
0
    def __init__(self, *args, **kwargs):
        super(Scene,self).__init__(*args, **kwargs)

        self.filename = self.getMember('filename')
        self.script     = self.getMember(Scriptable.getTypeName())
Exemple #24
0
 def __init__(self, *args, **kwargs):
     super(Lighting,self).__init__(*args, **kwargs)
     self.filename   = self.getMember('filename')
     self.shaders    = self.getMember(Shader.getTypeName())
     self.script     = self.getMember(Scriptable.getTypeName())
Exemple #25
0
 def _initMembersDict(self):
     super(Lighting, self)._initMembersDict()
     self._members['filename']                 = [str, '']
     self._members[Scriptable.getTypeName()]   = [Scriptable, None]
     self._members[Shader.getTypeName()]       = [Shader, []]
Exemple #26
0
 def updateMembers(self):
     self.setMember('name', self._name)
     self.setMember(DataObject.getTypeName(), self._data)
     self.setMember(RenderObject.getTypeName(), self._robjs)
     self.setMember(Scriptable.getTypeName(), self.script)
Exemple #27
0
    def __init__(self, *args, **kwargs):
        super(Camera,self).__init__(*args, **kwargs)

        self.filename   = self.getMember('filename')
        self.script     = self.getMember(Scriptable.getTypeName())
        self.moving_camera = self.getMember('moving_camera')