def add_entities(self): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 y = 0 for idx, item in enumerate(self.item_names): if idx % num_cols == 0: x += 1 self.items.append( general.new_object("Entity", item, "", x, idx % num_cols, 0)) # clear the selection and add the new items to the selection general.select_objects(self.items)
def add_entities(self): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 y = 0 for idx, item in enumerate(self.item_names): if idx % num_cols == 0: x += 1 self.items.append( general.new_object("Entity", item, "", x, idx % num_cols, 0) ) # clear the selection and add the new items to the selection general.select_objects(self.items)
def add_cgfs(self): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 for idx, item in enumerate(self.cgf_files): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += self.increment_amount ob = general.new_object("Brush", self.norm_path_for_ce(item), "", x, (idx % num_cols) * 0.23, 32) self.items.append(ob) general.select_object(ob) self.set_increment_amount() general.log("Added %s CGF Files to the map." % len(self.cgf_files))
def add_cgfs(self): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 for idx, item in enumerate(self.cgf_files): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += self.increment_amount ob = general.new_object( "Brush", self.norm_path_for_ce(item), "", x, (idx % num_cols) * 0.23, 32 ) self.items.append(ob) general.select_object(ob) self.set_increment_amount() general.log("Added %s CGF Files to the map." % len(self.cgf_files))
def add_cgfs(items): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 increment_amount = 0 for idx, item in enumerate(items): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += increment_amount general.select_object( general.new_object("Brush", norm_path_for_ce(item), "", x, (idx % num_cols) * 55, 32)) increment_amount = set_increment_amount() print("Added %s CGF Files to the map. Thanks for adding every damn CGF!" % len(items))
def add_cgfs(items): """spawn in each of the cgfs from the array passed in and then return the names of the items""" added_names = [] num_cols = 25 x = 0 increment_amount = 0 for idx, item in enumerate(items): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += increment_amount new_object = general.new_object("Brush", norm_path_for_ce(item), "", x, (idx % num_cols) * 55, 32) general.select_object(new_object) increment_amount = set_increment_amount() added_names.append(new_object) general.clear_selection() general.select_objects(added_names) return added_names
def add_cgfs(items): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 increment_amount = 0 for idx, item in enumerate(items): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += increment_amount general.select_object( general.new_object( "Brush", norm_path_for_ce(item), "", x, (idx % num_cols) * 55, 32 ) ) increment_amount = set_increment_amount() print( "Added %s CGF Files to the map. Thanks for adding every damn CGF!" % len(items) )
def add_cgfs(items): """spawn in each of the cgfs from the array passed in and then return the names of the items""" added_names = [] num_cols = 25 x = 0 increment_amount = 0 for idx, item in enumerate(items): if idx % num_cols == 0: # increment by some amount set by the last objects x width x += increment_amount new_object = general.new_object( "Brush", norm_path_for_ce(item), "", x, (idx % num_cols) * 55, 32 ) general.select_object(new_object) increment_amount = set_increment_amount() added_names.append(new_object) general.clear_selection() general.select_objects(added_names) return added_names
def add_xmls(self): """spawn in each of our items from self.item_names and then select them""" num_cols = 25 x = 0 num_added = 0 for idx, item in enumerate(self.item_names): if idx % num_cols == 0: x += 1 if item not in self.exclude_list: self.items.append( general.new_object("Entity", item, "", x, idx % num_cols, 0) ) num_added += 1 else: idx -= 1 print( "Added %s CGF Files to the map. Thanks for adding every damn entity!" % num_added )
def replace_selected(): new_objects = list() # get the mesh to replace the selected item with replacement_mesh = general.open_file_box() # get all selected object selected = general.get_names_of_selected_objects() # clear the selection so we can work on one item at a time general.clear_selection() for item in selected: # store the items xforms [scale_x, scale_y, scale_z] = general.get_scale(item) [pos_x, pos_y, pos_z] = general.get_position(item) [rot_x, rot_y, rot_z] = general.get_rotation(item) general.delete_object(item) new_objects.append( general.new_object("Brush", replacement_mesh, item, pos_x, pos_y, pos_z) ) general.set_rotation(item, rot_x, rot_y, rot_z) general.set_scale(item, scale_x, scale_y, scale_z) print("Replaced: %s with %s" % (item, replacement_mesh)) general.select_objects(new_objects)
def replace_selected(): new_objects = list() # get the mesh to replace the selected item with replacement_mesh = general.open_file_box() # get all selected object selected = general.get_names_of_selected_objects() # clear the selection so we can work on one item at a time general.clear_selection() for item in selected: # store the items xforms [scale_x, scale_y, scale_z] = general.get_scale(item) [pos_x, pos_y, pos_z] = general.get_position(item) [rot_x, rot_y, rot_z] = general.get_rotation(item) general.delete_object(item) new_objects.append( general.new_object("Brush", replacement_mesh, item, pos_x, pos_y, pos_z)) general.set_rotation(item, rot_x, rot_y, rot_z) general.set_scale(item, scale_x, scale_y, scale_z) print("Replaced: %s with %s" % (item, replacement_mesh)) general.select_objects(new_objects)
def new_object(entity_type, model, name, x, y, z): return Transformable( general.new_object(entity_type, model, name, x, y, z))
# 1. Get selected object. # grab some properties for our selected object user_selection = general.get_names_of_selected_objects()[0] if stored_brush is None: print('Simulating Brush') # store the users selection for setting the physics state later on store.set("simmed_brush", user_selection) # grab the transforms of the object obj_pos = general.get_position(user_selection) obj_rot = general.get_rotation(user_selection) obj_scale = general.get_scale(user_selection) # 2. Create rigid body ex and copy model to rigidbodyex # create the object at 0,0,0 PHYS_OBJECT_NAME = general.new_object("Entity", r"RigidBodyEx", PHYS_OBJECT_NAME, 0, 0, 0) # mark it with a special material so you know it's being simulated general.set_custom_material(PHYS_OBJECT_NAME, 'Materials/Special/green_screen.mtl') # set the physobj to be the selected brush object user_selection_brush = str(lodtools.getselected()) general.set_entity_geometry_file(PHYS_OBJECT_NAME, user_selection_brush) # 3. snap physobj to xform of selected object general.set_position(PHYS_OBJECT_NAME, int(obj_pos[0]), int(obj_pos[1]), int(obj_pos[2])) general.set_rotation(PHYS_OBJECT_NAME, int(obj_rot[0]), int(obj_rot[1]), int(obj_rot[2])) general.set_scale(PHYS_OBJECT_NAME, int(obj_scale[0]), int(obj_scale[1]), int(obj_scale[2]))