def draw(visible_loc_names): """Draws navigation curves, map lines and trigger lines from given dictionary of locator names as keys. :param visible_loc_names: dictionary of visible prefab locators names :type visible_loc_names: dict """ scs_globals = _get_scs_globals() if ready_for_draw(): connections = bpy.data.collections[_COLLECTION_NAME][_core.MAIN_DICT][ _core.REFS][_core.CONNECTIONS][_core.ENTRIES] # gets visible connections and draw them conns_to_draw = _core.gather_connections_upon_selected( bpy.data.collections[_COLLECTION_NAME], visible_loc_names) for conn_key in conns_to_draw.keys(): conn_entry = connections[conn_key] locator_type = bpy.data.objects[conn_entry[ _core.IN]].scs_props.locator_prefab_type if locator_type == "Navigation Point": _gl_primitive.draw_shape_curve(conn_entry[_core.DATA], not conn_entry[_core.VALID], scs_globals) else: _gl_primitive.draw_shape_line(conn_entry[_core.DATA], not conn_entry[_core.VALID], locator_type == "Map Point", scs_globals)
def draw(visible_loc_names): """Draws navigation curves, map lines and trigger lines from given dictionary of locator names as keys. :param visible_loc_names: dictionary of visible prefab locators names :type visible_loc_names: dict """ scs_globals = _get_scs_globals() if _execute_draw(scs_globals.optimized_connections_drawing): connections = bpy.data.groups[_GROUP_NAME][_core.MAIN_DICT][_core.REFS][_core.CONNECTIONS][_core.ENTRIES] # gets visible connections and draw them conns_to_draw = _core.gather_connections_upon_selected(bpy.data.groups[_GROUP_NAME], visible_loc_names) for conn_key in conns_to_draw.keys(): conn_entry = connections[conn_key] locator_type = bpy.data.objects[conn_entry[_core.IN]].scs_props.locator_prefab_type if locator_type == "Navigation Point": _gl_primitive.draw_shape_curve(conn_entry[_core.DATA], not conn_entry[_core.VALID], scs_globals) else: _gl_primitive.draw_shape_line(conn_entry[_core.DATA], not conn_entry[_core.VALID], locator_type == "Map Point", scs_globals)
def get_curves(np_locators): """Gets all the connections within given Navigation Point locators list. If some of locators are not Navigation Point locators they are automaticly ignored :param np_locators: list of SCS Navigation Point locator objects :type np_locators: list of bpy.types.Object :return: dictionary of curves within given locators with given keys structure; :rtype: dict[int, ConnEntry] """ connections = bpy.data.groups[_GROUP_NAME][_core.MAIN_DICT][_core.REFS][ _core.CONNECTIONS][_core.ENTRIES] locators = bpy.data.groups[_GROUP_NAME][_core.MAIN_DICT][_core.REFS][ _core.LOCATORS] # filter out all Navigation Point locators np_locs_names = {} for loc in np_locators: if loc.scs_props.locator_prefab_type == "Navigation Point": np_locs_names[loc.name] = 1 # gather all the connections of navigation points conns_keys_dict = _core.gather_connections_upon_selected( bpy.data.groups[_GROUP_NAME], np_locs_names) curves = {} i = 0 for conn_key in conns_keys_dict.keys(): conn_entry = connections[conn_key] # check validity of connection; if not valid don't add to curves if conn_entry[_core.VALID]: start_node = conn_entry[_core.OUT] end_node = conn_entry[_core.IN] # find valid next curves keys next_curves = [] for next_conn_key in locators[end_node][_core.OUT_CONNS]: next_conn_entry = connections[next_conn_key] if next_conn_entry[_core.VALID]: next_curves.append(next_conn_key) # find valid previous curves keys prev_curves = [] for prev_conn_key in locators[start_node][_core.IN_CONNS]: prev_conn_entry = connections[prev_conn_key] if prev_conn_entry[_core.VALID]: prev_curves.append(prev_conn_key) curves[conn_key] = ConnEntry(i, start_node, end_node, next_curves, prev_curves) i += 1 # increment index of curve only if it was added return curves
def get_curves(np_locators): """Gets all the connections within given Navigation Point locators list. If some of locators are not Navigation Point locators they are automaticly ignored :param np_locators: list of SCS Navigation Point locator objects :type np_locators: list of bpy.types.Object :return: dictionary of curves within given locators with given keys structure; :rtype: dict[int, ConnEntry] """ connections = bpy.data.groups[_GROUP_NAME][_core.MAIN_DICT][_core.REFS][_core.CONNECTIONS][_core.ENTRIES] locators = bpy.data.groups[_GROUP_NAME][_core.MAIN_DICT][_core.REFS][_core.LOCATORS] # filter out all Navigation Point locators np_locs_names = {} for loc in np_locators: if loc.scs_props.locator_prefab_type == "Navigation Point": np_locs_names[loc.name] = 1 # gather all the connections of navigation points conns_keys_dict = _core.gather_connections_upon_selected(bpy.data.groups[_GROUP_NAME], np_locs_names) curves = {} i = 0 for conn_key in conns_keys_dict.keys(): conn_entry = connections[conn_key] # check validity of connection; if not valid don't add to curves if conn_entry[_core.VALID]: start_node = conn_entry[_core.OUT] end_node = conn_entry[_core.IN] # find valid next curves keys next_curves = [] for next_conn_key in locators[end_node][_core.OUT_CONNS]: next_conn_entry = connections[next_conn_key] if next_conn_entry[_core.VALID]: next_curves.append(next_conn_key) # find valid previous curves keys prev_curves = [] for prev_conn_key in locators[start_node][_core.IN_CONNS]: prev_conn_entry = connections[prev_conn_key] if prev_conn_entry[_core.VALID]: prev_curves.append(prev_conn_key) curves[conn_key] = ConnEntry(i, start_node, end_node, next_curves, prev_curves) i += 1 # increment index of curve only if it was added return curves