Esempio n. 1
0
def main():
    selected = general.get_names_of_selected_objects()
    print(selected)
    input_axis = {"X": 0, "Y": 1, "Z": 2}
    axis = input_axis[str(general.edit_box("Axis: X, Y, Z")).upper()]
    num_copies = int(general.edit_box("Number of Clones"))
    distance = int(general.edit_box("Distance between clones"))
    for mesh_idx, mesh in enumerate(selected):
        start_pos = general.get_position(mesh)
        start_rot = general.get_rotation(mesh)
        start_scale = general.get_scale(mesh)
        for idx in xrange(num_copies):
            new_mesh = general.create_object(
                "Brush",
                general.get_entity_geometry_file(selected[mesh_idx]),
                mesh,
                0,
                0,
                0,
            )
            new_pos = [x for x in start_pos]
            new_pos[axis] += distance * (idx + 1)
            new_mesh.position = (new_pos[0], new_pos[1], new_pos[2])
            new_mesh.rotation = (start_rot[0], start_rot[1], start_rot[2])
            new_mesh.scale = (start_scale[0], start_scale[1], start_scale[2])
            new_mesh.update()
Esempio n. 2
0
def paste_xforms():
    store = UserValues()
    selected = general.get_names_of_selected_objects()[0]
    if selected is None:
        general.message_box_ok("Please Select an object")
    xforms = store.get("xforms")
    general.set_position(selected, xforms['pos'][0], xforms['pos'][1], xforms['pos'][2])
    general.set_rotation(selected, xforms['rot'][0], xforms['rot'][1], xforms['rot'][2])
    general.set_scale(selected, xforms['scale'][0], xforms['scale'][1], xforms['scale'][2])
Esempio n. 3
0
def copy_xforms():
    store = UserValues()
    selected = general.get_names_of_selected_objects()[0]
    if selected is None:
        general.message_box_ok("Please Select an object")
    rot = general.get_rotation(selected)
    pos = general.get_position(selected)
    scale = general.get_scale(selected)
    store.set("xforms", {"rot": rot, "pos": pos, "scale": scale})
Esempio n. 4
0
    def start(self):
        """method called when button is pushed
		kicks the whole thing off"""
        # get and store the selection
        self.selected = general.get_names_of_selected_objects()
        # loop through the selection
        for self.entity in self.selected:
            # get the items geometry file
            general.get_entity_property(self.entity, '')
	def start(self):
		"""method called when button is pushed
		kicks the whole thing off"""
		# get and store the selection
		self.selected = general.get_names_of_selected_objects()
		# loop through the selection
		for self.entity in self.selected:
			# get the items geometry file
			general.get_entity_property(self.entity, '')
Esempio n. 6
0
def main():
    cwd = os.getcwd()
    selection = general.get_names_of_selected_objects()
    file_path_list = list()

    for obj in selection:
        geom_file = general.get_entity_geometry_file(obj)
        file_path = cwd + "\\GameSDK\\" + geom_file
        file_path_list.append(file_path)

    for path in file_path_list:
        command = r'explorer /select, "%s"' % path
        print(command)
        subprocess.Popen(command)
Esempio n. 7
0
def get_objects():
    selection = general.get_names_of_selected_objects()
    # test if we have anything selected and warn the user about each operation
    if len(selection) == 1:
        return get_selected_objects(selection)
    elif len(selection) == 0:
        sure = general.message_box(
            "You have no objects selected which means you will be will hiding all. This will probably crash on islands. Are you sure?"
        )
        if sure:
            return get_all_objects()
    elif len(selection) > 15:
        sure = general.message_box(
            "You have a large number of items selected. This may crash, make sure you save first."
        )
        if sure:
            return get_selected_objects(selection)
    else:
        return get_selected_objects(selection)
Esempio n. 8
0
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)
Esempio n. 9
0
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)
Esempio n. 10
0
    "PuddlesAmount",
    "puddlesMaskAmount",
    "puddlesRippleAmount",
    "RainDropsAmount",
    "RainDropsLighting",
    "RainDropsSpeed",
    "SplashesAmount",
]

# ramp up pattern
print("ramp up pattern")
retVal = "self:SetRainValues("
counter = 0
for x in properties:
    counter = counter + 1
    selObj = general.get_names_of_selected_objects()
    temp = general.get_entity_property(selObj[0], x)
    # 0.5*rp, 0.0*rp, 0.11*rp, 1.0, 0.7, 1.0, 0.1*rp, 2.0, 1.0, 1.0*rp
    if ((counter == 1) or (counter == 2) or (counter == 3) or (counter == 7)
            or (counter == 10)):
        retVal = retVal + str(temp) + "*rp,"
    else:
        retVal = retVal + str(temp) + ","
print(retVal + ");")

# holding pattern
retVal = "self:SetRainValues("
for x in properties:
    selObj = general.get_names_of_selected_objects()
    temp = general.get_entity_property(selObj[0], x)
    retVal = retVal + str(temp) + ","
Esempio n. 11
0
    min_y = min([item[1] for item in item_positions])
    for idx, item in enumerate(selected_items):
        general.set_position(item, item_positions[idx][0], min_y,
                             item_positions[idx][2])


def align_min_z(selected_items):
    item_positions = [general.get_position(item) for item in selected_items]
    min_z = min([item[2] for item in item_positions])
    for idx, item in enumerate(selected_items):
        general.set_position(item, item_positions[idx][0],
                             item_positions[idx][1], min_z)


if __name__ == "__main__":
    _selected_items = general.get_names_of_selected_objects()
    x = True if sys.argv[1] == "x" else False
    y = True if sys.argv[1] == "y" else False
    z = True if sys.argv[1] == "z" else False
    neg_x = True if sys.argv[1] == "-x" else False
    neg_y = True if sys.argv[1] == "-y" else False
    neg_z = True if sys.argv[1] == "-z" else False
    if x:
        align_x(_selected_items)
    if y:
        align_y(_selected_items)
    if z:
        align_z(_selected_items)
    if neg_x:
        align_min_x(_selected_items)
    if neg_y:
Esempio n. 12
0
 def selected(self):
     return mutate(general.get_names_of_selected_objects())
Esempio n. 13
0
# 	7. after simulation is done copy original object to new xform of simulated rigid body
# 	8. delete rigid body.
import general
import lodtools
import physics

from user_values import UserValues

PHYS_OBJECT_NAME = "brush_sim_temp"

if __name__ == "__main__":
    store = UserValues()
    stored_brush = store.get("simmed_brush")
    # 	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
Esempio n. 14
0
        "amount",
        "DiffuseDarkening",
        "FakeReflectionsAmount",
        "PuddlesAmount",
        "puddlesMaskAmount",
        "puddlesRippleAmount",
        "RainDropsAmount",
        "RainDropsLighting",
        "RainDropsSpeed",
        "SplashesAmount",
    ]

    # holding pattern for loop
    retVal = "self:SetRainValues("
    for x in properties:
        selObj = general.get_names_of_selected_objects()
        temp = general.get_entity_property(selObj[0], x)
        retVal = retVal + str(temp) + ","
        # print out the holding pattern
    print("holding pattern")
    print(retVal + ");")

    # ramp u pattern for loop
    print("ramp up pattern")
    retVal = "self:SetRainValues("
    counter = 0
    for x in properties:
        counter = counter + 1
        selObj = general.get_names_of_selected_objects()
        temp = general.get_entity_property(selObj[0], x)
        # 0.5*rp, 0.0*rp, 0.11*rp, 1.0, 0.7, 1.0, 0.1*rp, 2.0, 1.0, 1.0*rp
Esempio n. 15
0
 def function_wrapper(*args, **kwargs):
     selected = general.get_names_of_selected_objects()
     func(*args, **kwargs)
     general.clear_selection()
     general.select_objects(selected)
Esempio n. 16
0
        general.set_position(
            item, item_positions[idx][0], min_y, item_positions[idx][2]
        )


def align_min_z(selected_items):
    item_positions = [general.get_position(item) for item in selected_items]
    min_z = min([item[2] for item in item_positions])
    for idx, item in enumerate(selected_items):
        general.set_position(
            item, item_positions[idx][0], item_positions[idx][1], min_z
        )


if __name__ == "__main__":
    _selected_items = general.get_names_of_selected_objects()
    x = True if sys.argv[1] == "x" else False
    y = True if sys.argv[1] == "y" else False
    z = True if sys.argv[1] == "z" else False
    neg_x = True if sys.argv[1] == "-x" else False
    neg_y = True if sys.argv[1] == "-y" else False
    neg_z = True if sys.argv[1] == "-z" else False
    if x:
        align_x(_selected_items)
    if y:
        align_y(_selected_items)
    if z:
        align_z(_selected_items)
    if neg_x:
        align_min_x(_selected_items)
    if neg_y: