def __init__(self): self.height = render.getWindowHeight() self.width = render.getWindowWidth() self.scale = self.width / self.height self.scene_gui = utils.getSceneByName(constant.CORE_SCENE_GUI) module.scene_gui = self.scene_gui self.camera = self.scene_gui.active_camera self.camera_height = self.camera.worldPosition.z - 0.5 self.cursor = None self.cursor_position = None self.hitobj = None self.hitpoint = None self.hitnormal = None self.hitpoly = None self.hitproperty = "" self.hitxray = 0 #Scale Camera X/Y if self.camera: self.scx = self.camera.ortho_scale self.scy = self.camera.ortho_scale * (self.height / self.width) self.camera.frustum_culling = False logic.mouse.position = (0.5, 0.5)
def __init__(self): self.height = render.getWindowHeight() self.width = render.getWindowWidth() self.scale = self.width / self.height self.scene_gui = utils.getSceneByName(constant.CORE_SCENE_GUI) module.scene_gui = self.scene_gui self.camera = self.scene_gui.active_camera self.camera_height = self.camera.worldPosition.z - 0.5 self.cursor = None self.cursor_position = None self.hitobj = None self.hitpoint = None self.hitnormal = None self.hitpoly = None self.hitproperty = "" self.hitxray = 0 #Scale Camera X/Y if self.camera: self.scx = self.camera.ortho_scale self.scy = self.camera.ortho_scale * (self.height / self.width) self.camera.frustum_culling = False logic.mouse.position = (0.5,0.5)
def loadScene(filepath, name): """ Loads a new scene from another blend. Blends loaded with this method must have only 1 scene. They also need to have a Python controller conected with an always on module mode with the following string: ``main.libload``. This logic bricks are recomended to be used in an object that clearly is the main object of the scene or a camera if any. The name of the library is the filepath. :param string filepath: Relative path from the *data* folder where the blend file is placed. :param string name: Name of the new scene, used with *behavior.Scene*. """ global _change_scene_name global _change_scene_path if module.change_scene_dynamic == False: module._started = False module.change_scene_dynamic = True utils.setScene("Dynamic") _change_scene_name = name _change_scene_path = filepath module.change_scene_dynamic_state = 1 return #Once scene is loaded else: if name or filepath: return name = _change_scene_name scene = utils.getSceneByName("Dynamic") if not scene: return state = module.change_scene_dynamic_state if state == 1: module.change_scene_dynamic_state += 1 module.scene_game = scene if name in module.scene_behavior_dict: module.scene_behavior = (module.scene_behavior_dict[name])() b = module.scene_behavior b.scene = scene loadIntoScene(_change_scene_path, "Scene", scene.active_camera) return if state == 2: return if state == 3: #+1 on main.libload module.change_scene_dynamic_state = 0 module.change_scene_frame = False module.change_scene_dynamic = False if name in module.scene_behavior_dict: b = module.scene_behavior for ob in scene.objects: b.objects[ob.name] = ob for ob in scene.objectsInactive: b.objectsInactive[ob.name] = ob b.init() b.baseInit() for bh in b.behaviors: bh.init()
from core import utils from script import constant window = None widget_dict = {} scene = utils.getSceneByName(constant.CORE_SCENE_GUI)