cellpack.autopack.upy.simularium package¶
Submodules¶
cellpack.autopack.upy.simularium.plots module¶
cellpack.autopack.upy.simularium.simularium_helper module¶
- class cellpack.autopack.upy.simularium.simularium_helper.Instance(name, instance_id, unique_id, radius, viz_type, mesh=None)[source]¶
Bases:
object
- class cellpack.autopack.upy.simularium.simularium_helper.simulariumHelper(master=None, vi=None)[source]¶
Bases:
Helper
The Simularium helper abstract class¶
This is the Simularium helper Object. The helper give access to the basic function need for create and edit a host 3d object and scene.
- DATABASE = 'https://raw.githubusercontent.com/mesoscope/cellPACK_data/master/cellPACK_database_1.1.0'¶
- DEBUG = 0¶
- EMPTY = 'Simularium.Geom'¶
- INSTANCE = 'Simularium.Geom'¶
- ObjectsSelection(listeObjects, typeSel='new')[source]¶
Modify the current object selection.
@type listeObjects: list @param listeObjects: list of object to joins @type typeSel: string @param listeObjects: type of modification: new,add,…
- POLYGON = 'Simularium.IndexedPolygons'¶
- SPHERE = 'Simularium.Spheres'¶
- SPLINE = 'kNurbsCurve'¶
- ToVec(v, pos=True)[source]¶
Return a python xyz array from a host xyz array/vector
overwrited by children class for each host
@type v: host vector array @param v: host vector array @rtype: array @return: the converted vector array
- VERBOSE = 0¶
- addCameraToScene()[source]¶
Add a camera object to the scene
overwrited by children class for each host
>>> sc = helper.getCurrentScene() >>> center=[0.,-12.,40.] >>> cam = helper.addCameraToScene("cam1","persp",30.,center,sc)
@type name: string @param name: name of the camera @type Type: cameraType @param Type: perspective, orthogonale etc… @type focal: float @param focal: the focal of the camera @type center: list @param center: the position of the camera @type scene: host scene @param scene: the scene #we add a **kw for futur arguments
- addLampToScene()[source]¶
Add a light to the scene
overwrited by children class for each host
>>> sc = helper.getCurrentScene() >>> center=[0.,-12.,40.] >>> color = [1.,1.,1.] >>> light = helper.addLampToScene("light1","Sun",color,20.,1.0,1.0,True,center,sc)
@type name: string @param name: name of the instance @type Type: light hostType/int etc.. @param Type: the light type : spot,sun,omni,etc.. @type rgb: list of int 0-255 @param rgb: color of the light in rgb @type dist: float @param dist: light distance of attenuation @type energy: float @param energy: intensity of the light @type soft: bool @param soft: soft light @type shadow: boolean @param shadow: does the light produce shadow @type scene: host scene @param scene: the scene #we add a **kw for futur arguments
- addMaterial(name, color)[source]¶
Add a material in the current document
overwrited by children class for each host
@type name: string @param name: the material name @type color: array @param color: the material color (r,g,b)
@rtype: hostMaterial @return: the new material
- add_instance(name, ingredient, instance_id, radius, position=None, rotation=None, sub_points=None, mesh=None)[source]¶
- add_new_instance_and_update_time(name, ingredient, instance_id, position=None, rotation=None, sub_points=None)[source]¶
- add_object_to_scene(doc, ingredient, instance_id, position=None, rotation=None, control_points=None)[source]¶
- assignMaterial(object, mat, texture=False)[source]¶
Assign the provided material to the object
overwrited by children class for each host
@type object: hostApp object @param object: the object @type matname: string @param matname: the material name @type texture: Boolean @param texture: is the material use a textue @type kw: dictionary @param kw: additional keywords options
- box(name, center=[0.0, 0.0, 0.0], size=[1.0, 1.0, 1.0], cornerPoints=None, **kw)[source]¶
Create a hostobject of type cube.
overwrited by children class for each host
@type name: string @param name: name of the box @type center: array @param center: the center of the box @type size: array @param size: the size in x y z direction @type cornerPoints: array list @param cornerPoints: the upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the cube after creation (deprecated) @type kw: dictionary @param kw: additional keywords options
@rtype: hostObject,hostMesh @return: the created box object and mesh
- changeColor(obj, colors, perVertex=False, proxyObject=False, doc=None, pb=False)[source]¶
Apply the given set of color to the given object, if the object is a mesh this function handle the color per vertex.
overwrited by children class for each host
@type obj: string or hostObject @param obj: the object to be colored @type colors: list @param colors: the list of colors to apply [[r,g,b],[r,g,b],…] @type perVertex: Boolean @param perVertex: is it color per Vertex @type proxyObject: Boolean @param proxyObject: special keyword for Cinema4D which doesnt support vertex color @type doc: Scene @param doc: the current working documents @type pb: Boolean @param pb: use the progress bar @type facesSelection: liste @param facesSelection: only assign color to the given face selecion @type faceMaterial: Boolean @param faceMaterial: assign color per Face
- changeObjColorMat(obj, color)[source]¶
Change the diffuse color of the object material.
overwrited by children class for each host
@type obj: string or hostObject @param obj: the object forwhich we want to change e material color @type color: list @param color: the new color to apply [r,g,b]
- concatObjectMatrix()[source]¶
Apply a matrix to an hostObject
overwrited by children class for each host
@type object: hostObject @param object: the object who receive the transformation @type hostmatrice: list/Matrix @param hostmatrice: transformation matrix in host format @type matrice: list/Matrix @param matrice: transformation matrix in epmv/numpy format
- getAllMaterials()[source]¶
Get all the maerials of the current scene.
overwrited by children class for each host
@rtype: list @return: the list of all materials available
- getCornerPointCube(cube)[source]¶
Return the corner Point of the Given Cube/Box
@type obj: string @param obj: name of the box
@rtype: array 2x3 @return: the upper-left and bottom right corner point coordinates
- getCurrentScene()[source]¶
Return the current/active working document or scene.
overwrited by children class for each host
>>> sc = helper.getCurrentScene() >>> print (sc) None #in maya there is no scene concept <bpy_strct, Scene("Scene") #blender 2.6 [Scene "Scene"] #blender 2.49b <c4d.documents.BaseDocument object at 0x246c01a0> #Cinema4D
@rtype: scene @return: the active scene
- getCurrentSelection()[source]¶
Return the current/active selected object in the document or scene Simularium support only one object at a time. @rtype: liste @return: the list of selected object
- getFace(face)[source]¶
Convert the face edge in python format
overwrited by children class for each host
@type hostface: hostFace @param hostface: the face to convert to python @type kw: dictionary @param kw: dictionary of arg options.
r=True : Cinema4D reverse face order
@rtype: list @return: the face in python format [i,j,k]
- getMaterial(mat)[source]¶
Get the maerial of the given name.
overwrited by children class for each host
@type name: string @param name: the name of the desired material
@rtype: hostMaterial @return: the new material
- getMesh(m, **kw)[source]¶
Get the mesh of given name
overwrited by children class for each host
@type name: string @param name: the name of the deired mesh
@rtype: hostMesh @return: the mesh
- getMeshEdges(poly)[source]¶
Get the edges of the given polygon object data
overwrited by children class for each host
@type poly: hostObject @param poly: the object from which we want the edges @type selected: Boolean @param selected: return only the selected edges or not @type kw: dictionary @param kw: dictionary of arg options
@rtype: list @return: all or selected edges of the given object
- getMeshFaces(poly)[source]¶
Get the faces of the given polygon object data
overwrited by children class for each host
@type poly: hostObject @param poly: the object from which we want the faces @type selected: Boolean @param selected: return only the selected faces or not @type kw: dictionary @param kw: dictionary of arg options
@rtype: list @return: all or selected faces of the given object
- getMeshNormales(poly)[source]¶
Get the normals of the given polygon object data
overwrited by children class for each host
@type poly: hostObject @param poly: the object from which we want the normals @type selected: Boolean @param selected: return only the selected normals or not @type kw: dictionary @param kw: dictionary of arg options
@rtype: list of array xyz @return: coordinate for all or for selected normals of the given object
- getMeshVertices(poly, transform=False)[source]¶
Get the vertices of the given polygon object data
overwrited by children class for each host
@type poly: hostObject @param poly: the object from which we want the vertices @type selected: Boolean @param selected: return only the selected vertices or not @type kw: dictionary @param kw: dictionary of arg options
@rtype: list of array xyz @return: coordinate for all or for selected vertices of the given object
- getName(o)[source]¶
Return the name of an host object. Redundant with getObjecName
overwrited by children class for each host
>>> obj = helper.Sphere("mySphere") >>> name = helper.getObjectName(obj) >>> print (name) mySphere
@type object: hostObject @param object: an host object @rtype: string @return: the name of the host object
- getObject(name)[source]¶
Retrieve an object from his name.
overwrited by children class for each host
>>> oname = "mysphere" >>> object= helper.getObject(oname) >>> print oname,object#the result depnds on the host mysphere <c4d.BaseObject object at 0x1e4fc4b0> # Cinema4D mysphere # Maya
@type name: string @param name: request name of an host object
@rtype: hostObject @return: the object with the requested name or None
- getTranslation(name)[source]¶
Return the current position (translation) of the given object in absolute or local world
overwrited by children class for each host
@type name: hostObject @param name: the object name @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
@rtype: 3d vector/list @return: the position
- getVisibility(obj, editor=True, render=False, active=False)[source]¶
return the editor/renedring/active visibility state of the given object
overwrited by children class for each host
@type obj: hostObject @param obj: the object @type editor: boolean @param editor: request editor visibility @type render: boolean @param render: request rendering visibility @type active: boolean @param active: request active states ie C4D
@rtype: bool/array of bool @return: the current visibility state of the object
- host = 'simularium'¶
- init_scene_with_objects(objects, grid_point_positions=None, grid_point_compartment_ids=None, show_sphere_trees=False, grid_pt_radius=0.5)[source]¶
- newEmpty(name, location=None, parentCenter=None, display=1, visible=0, **kw)[source]¶
Create a new Null/Empty Object
overwrited by children class for each host
>>> empty = helper.newEmpty("null1",location=[10.0,0.0,0.0]) >>> empty_child = helper.newEmpty("null2",location=[15.0,0.0,0.0],parent = empty)
@type name: string @param name: name of the empty @type location: list @param location: position of the null object @type parentCenter: list @param parentCenter: position of the parent object DEPRECATED
@type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
-“parent”
@rtype: hostObject @return: the null object
- pathDeform(*args, **kw)[source]¶
Should create a modifierfor the given object using the given path/curve/spline TO DO.
overwrited by children class for each host
@type args: list @param args: list of arguments options @type kw: dictionary @param kw: dictionary of arguments options
- pb = False¶
- plane(name, center=[0.0, 0.0, 0.0], size=[1.0, 1.0], cornerPoints=None, visible=1, **kw)[source]¶
Create a hostobject of type cube.
overwrited by children class for each host
@type name: string @param name: name of the plane @type center: array @param center: the center of the plane @type size: array @param size: the size in x y z direction @type cornerPoints: array list @param cornerPoints: the upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the plane after creation (deprecated) @type kw: dictionary @param kw: list of additional arguments : “material”, subdivision”, axis”
@rtype: hostObject,hostMesh @return: the created plane object and data
- progressBar(progress=None, label=None)[source]¶
update the progress bar status by progress value and label string @type progress: Int/Float @param progress: the new progress @type label: string @param label: the new message to put in the progress status
- reParent(obj, parent)[source]¶
Change the object parent using the specified parent objects
overwrited by children class for each host
@type objs: hostObject @param objs: the object or liste of objects to be reparented @type parent: hostObject @param parent: the new parent object
- rotateObj(obj, rot)[source]¶
Global Rotation : Rotate the object This method take a 3d array [rotation_X,rotatio_Y,rotation_Z]
overwrited by children class for each host
@type object: hostObject @param object: the object @type rotation: liste/array - matrice @param rotation: the new object rotation @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- scaleObj(obj, sc)[source]¶
Global Scale : scale the object by the vector scale
overwrited by children class for each host
@type object: hostObject @param object: the object @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- setObjectMatrix(object, matrice, **kw)[source]¶
Set a matrix to an hostObject
overwrited by children class for each host
@type object: hostObject @param object: the object who receive the transformation @type hostmatrice: list/Matrix @param hostmatrice: transformation matrix in host format @type matrice: list/Matrix @param matrice: transformation matrix in epmv/numpy format @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- setRigidBody(*args, **kw)[source]¶
Set the curren objec as a rigid body
@type doc: document/scene @param doc: the desired scene @type kw: dictionary @param kw: dictionary of arg options
- setTranslation(name, pos=[0.0, 0.0, 0.0])[source]¶
Return the current position (translation) of the given object in absolute or local world
overwrited by children class for each host
@type name: hostObject @param name: the object name @type pos: list<float> @param pos: the new position @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- spline(name, points, close=0, type=1, scene=None, parent=None)[source]¶
This will return a hostApp spline/curve object according the given list of point.
overwrited by children class for each host
@type name: string @param name: name for the object @type points: liste/array vector @param points: list of position coordinate of the curve point @type close: bool/int @param close: is the curve is closed @type type: int/string @param type: ususally describe type of curve, ie : bezier, linear, cubic, etc… @type scene: hostApp scene @param scene: the current scene @type parent: hostObject @param parent: the parent for the curve @type kw: dictionary @param kw: additional keywords options
@rtype: hostObject,hostMesh @return: the created spline object and data
- toggleDisplay(obj, display, **kw)[source]¶
Toggle on/off the display/visibility/rendermode of an hostObject in the host viewport.
overwrited by children class for each host
>>> helper.toggleDisplay("polygone1",True) >>> obj = helper.getObject("polygone1") >>> helper.toggleDisplay(obj,False)
@type object: hostObject @param object: the object @type display: boolean @param display: if the object is displayed
- translateObj(obj, position, use_parent=True)[source]¶
Global Translation : Move the object to the vector position
overwrited by children class for each host
@type object: hostObject @param object: the object @type position: liste/array @param position: the new object position px,py,pz @type use_parent: boolean @param use_parent: if the parent position is used @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- update()[source]¶
Update the host viewport, ui or gl draw This function can’t be call in a thread.
overwrited by children class for each host
- updateBox(box, center=[0.0, 0.0, 0.0], size=[1.0, 1.0, 1.0], cornerPoints=None)[source]¶
Update the given box.
overwrited by children class for each host
@type box: string @param box: name of the box @type center: array @param center: the new center of the box @type size: array @param size: the new size in x y z direction @type cornerPoints: array list @param cornerPoints: the new upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the cube after creation (deprecated) @type kw: dictionary @param kw: additional keywords options
- updateMasterInstance(master, newMesh, **kw)[source]¶
Update the reference of the passed instance by adding/removing-hiding objects
overwrited by children class for each host
>>> sph = helper.Sphere("sph1") >>> instance_sph = helper.newInstance("isph1",sph,location = [10.0,0.0,0.0])
@type instance: string/hostObj @param instance: name of the instance @type objects: list hostObject/string @param objects: the list of object to remove/add to the instance reference @type add: bool @param add: if True add the objec else remove @type hide: bool @param hide: hide instead of remove @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host
- updatePathDeform(*args, **kw)[source]¶
Should update the modifierfor the given object using the given path/curve/spline
TO DO.
overwrited by children class for each host
@type args: list @param args: list of arguments options @type kw: dictionary @param kw: dictionary of arguments options
- update_spline(name, new_points)[source]¶
This will update the spline points coordinates
overwrited by children class for each host
@type name: string @param name: name for the spline to update @type coords: liste/array vector @param coords: list of new position coordinate to apply to the curve point
- viewer = None¶
Module contents¶
Copyright (C) <2010> Autin L. TSRI
This file git_upy/dejavuTk/__init__.py is part of upy.
upy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
upy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with upy. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.