Exemplo n.º 1
0
    def test_select_all_children_with_name_grid_keeppos_set_keeppos_to_false(
            self):
        selData = []
        parmData = []
        parmDataSq = []
        objPath = "/obj"

        for i in hou.node(objPath).children():
            if i.name().find("grid_keeppos") != -1:
                selData.append(i)
                p = i.parm("keeppos")
                if p:
                    p.set(0)
                    if p.eval() == 0:
                        parmData.append(i)
                    p.set(1)

        sq = sQuery.sQuery()
        sel = sq.children("*grid_keeppos*")
        sel.setAttr("keeppos", 0)

        for i in sel._data:
            p = i.parm("keeppos")
            if p:
                if p.eval() == 0:
                    parmDataSq.append(i)
                p.set(1)

        self.assertListEqual(parmDataSq, parmData)
Exemplo n.º 2
0
	def test_select_all_children_with_name_grid_keeppos_set_keeppos_to_false(self):
		selData = []
		parmData = []
		parmDataSq = []
		objPath = "/obj"
		
		for i in hou.node(objPath).children():
			if i.name().find("grid_keeppos") != -1:
				selData.append(i)
				p = i.parm("keeppos")
				if p:
					p.set(0)
					if p.eval() == 0:
						parmData.append(i)
					p.set(1)

		sq = sQuery.sQuery()
		sel = sq.children("*grid_keeppos*")
		sel.setAttr("keeppos", 0)

		for i in sel._data:
			p = i.parm("keeppos")
			if p:
				if p.eval() == 0:
					parmDataSq.append(i)
				p.set(1)

		self.assertListEqual(parmDataSq, parmData)
Exemplo n.º 3
0
	def test_is_child_with_name_box_selected(self):
		boxPath = "/obj/box"
		box = hou.node(boxPath)

		sq = sQuery.sQuery()
		sel = sq.children("box")

		self.assertListEqual(sel._data, [box])
Exemplo n.º 4
0
    def test_is_child_with_name_box_selected(self):
        boxPath = "/obj/box"
        box = hou.node(boxPath)

        sq = sQuery.sQuery()
        sel = sq.children("box")

        self.assertListEqual(sel._data, [box])
Exemplo n.º 5
0
    def test_initialization_in_an_object(self):
        selData = []
        objPath = "/obj"
        pointlight4Address = objPath + "/pointlight4"
        pointlight4 = hou.node(pointlight4Address)
        selData.append(pointlight4)

        sel = sQuery.sQuery(pointlight4)
        self.assertListEqual(sel._data, selData)
Exemplo n.º 6
0
	def test_initialization_in_an_object(self):
		selData = []
		objPath = "/obj"
		pointlight4Address = objPath + "/pointlight4"
		pointlight4 = hou.node(pointlight4Address)
		selData.append(pointlight4)

		sel = sQuery.sQuery(pointlight4)
		self.assertListEqual(sel._data, selData)
Exemplo n.º 7
0
    def test_is_child_with_name_box_and_box1_selected(self):
        boxPath = "/obj/box"
        box = hou.node(boxPath)
        box1 = hou.node(boxPath + "1")
        boxes = [box, box1]

        sq = sQuery.sQuery()
        sel = sq.children("box box1")

        self.assertListEqual(sel._data, boxes)
Exemplo n.º 8
0
	def test_is_child_with_name_box_and_box1_selected(self):
		boxPath = "/obj/box"
		box = hou.node(boxPath)
		box1 = hou.node(boxPath + "1")
		boxes = [box, box1]

		sq = sQuery.sQuery()
		sel = sq.children("box box1")

		self.assertListEqual(sel._data, boxes)
Exemplo n.º 9
0
    def test_is_all_children_with_attribute_light_intensity_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.parm("light_intensity"):
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("[light_intensity]")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 10
0
    def test_is_all_children_with_type_name_has_ge_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.type().name().find("ge") != -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("t#*ge*")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 11
0
	def test_is_all_children_with_type_name_has_ge_or_has_li_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.type().name().find("ge") != -1 or i.type().name().find("li") != -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("t#*ge* t#*li*")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 12
0
	def test_is_all_children_with_name_has_box_and_type_geo_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.name().find("box") != -1 and i.type().name() == "geo":
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("*box*").filter("t#geo")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 13
0
	def test_is_all_children_with_attribute_light_intensity_or_scale_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.parm("light_intensity") or i.parm("scale"):
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("[light_intensity] [scale]")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 14
0
    def test_is_all_children_with_matching_name_box_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.name().find("box") != -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("*box*")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 15
0
	def test_is_all_subchildren_with_type_name_has_light_but_name_not_box(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("light") != -1 and i.name().find("box") == -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.find("t#*light*").remove("*box*")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 16
0
	def test_next_node_to_all_subchildren_that_are_type_facet_at_index_zero(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("facet") != -1:
				next = i.outputs()[0]
				selData.append(next)

		sq = sQuery.sQuery()
		sel = sq.find("t#*facet*").next()
		self.assertListEqual(sel._data, selData)
Exemplo n.º 17
0
	def test_get_first_child_with_type_name_has_ge_and_type_name_has_li_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.type().name().find("ge") != -1 or i.type().name().find("li") != -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("t#*ge* t#*li*")

		self.assertEqual(sel.get(0), selData[0])
Exemplo n.º 18
0
	def test_prev_node_to_all_subchildren_that_are_switch_at_index_one(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("switch") != -1:
				prev = i.inputs()[1]
				selData.append(prev)

		sq = sQuery.sQuery()
		sel = sq.find("t#*switch*").prev(index=1)
		self.assertListEqual(sel._data, selData)
Exemplo n.º 19
0
    def test_prev_node_to_all_subchildren_that_are_switch_at_index_one(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).allSubChildren():
            if i.type().name().find("switch") != -1:
                prev = i.inputs()[1]
                selData.append(prev)

        sq = sQuery.sQuery()
        sel = sq.find("t#*switch*").prev(index=1)
        self.assertListEqual(sel._data, selData)
Exemplo n.º 20
0
	def test_is_all_children_with_matching_name_box_and_matching_name_sphere_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.name().find("box") != -1 or i.name().find("sphere") != -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("*box* *sphere*")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 21
0
    def test_is_all_children_with_name_has_box_and_type_geo_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.name().find("box") != -1 and i.type().name() == "geo":
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("*box*").filter("t#geo")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 22
0
	def test_is_all_subchildren_with_type_name_facet_with_parent_name_has_box(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("facet") != -1 and i.parent().name().find("box") != -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.find("t#*facet*").parent("*box*").children("t#facet")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 23
0
    def test_select_children_that_has_type_facet_subchildren(self):
        selData = set()
        objPath = "/obj"
        for node in hou.node(objPath).children():
            for child in node.allSubChildren():
                if child.type().name().find("facet") != -1:
                    selData.add(node)

        sq = sQuery.sQuery()
        sel = sq.children().hasSubChildren("t#*facet*")

        self.assertListEqual(sel._data, list(selData))
Exemplo n.º 24
0
    def test_select_box1_from_bundle_box_content(self):
        selData = []
        targetBundle = hou.nodeBundle("box_bundle")
        nodes = targetBundle.nodes()
        for i in nodes:
            if i.name().find("box1") != -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.bundle("box_bundle").filter("*box1*")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 25
0
	def test_select_box1_from_bundle_box_content(self):
		selData = []
		targetBundle = hou.nodeBundle("box_bundle")
		nodes = targetBundle.nodes()
		for i in nodes:
			if i.name().find("box1") != -1:
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.bundle("box_bundle").filter("*box1*")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 26
0
	def test_select_children_that_has_type_facet_subchildren(self):
		selData = set()
		objPath = "/obj"
		for node in hou.node(objPath).children():
			for child in node.allSubChildren():
				if child.type().name().find("facet") != -1:
					selData.add(node)

		sq = sQuery.sQuery()
		sel = sq.children().hasSubChildren("t#*facet*")

		self.assertListEqual(sel._data, list(selData))
Exemplo n.º 27
0
    def test_next_node_to_all_subchildren_that_are_type_facet_at_index_zero(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).allSubChildren():
            if i.type().name().find("facet") != -1:
                next = i.outputs()[0]
                selData.append(next)

        sq = sQuery.sQuery()
        sel = sq.find("t#*facet*").next()
        self.assertListEqual(sel._data, selData)
Exemplo n.º 28
0
    def test_is_all_children_with_type_name_has_light_but_name_not_box(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.type().name().find("light") != -1 and i.name().find(
                    "box") == -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("t#*light*").remove("*box*")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 29
0
	def test_is_all_children_with_type_name_has_light_or_has_tx_10_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			parm = i.parm("tx")
			if parm and (i.type().name().find("light") != -1 or parm.eval() == 10):
				selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("[tx=10] t#*light*")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 30
0
    def test_is_all_children_with_type_name_has_light_and_tx_10_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            parm = i.parm("tx")
            if parm and i.type().name().find("light") != -1:
                if parm.eval() == 10:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("[tx=10]").filter("t#*light*")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 31
0
    def test_is_all_subchildren_with_type_name_facet_with_parent_name_has_box(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).allSubChildren():
            if i.type().name().find("facet") != -1 and i.parent().name().find(
                    "box") != -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.find("t#*facet*").parent("*box*").children("t#facet")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 32
0
	def test_is_all_children_with_tx_10_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			parm = i.parm("tx")
			if parm:
				if parm.eval() == 10:
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("[tx=10]")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 33
0
	def test_is_all_children_with_attribute_scale_3_selected(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			parm = i.parm("scale")
			if parm:
				if parm.eval() == 3:
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("[scale=3]")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 34
0
    def test_is_all_children_with_name_has_box_and_shoppath_has_est(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            parm = i.parm("shop_materialpath")
            if parm and i.name().find("box") != -1:
                if parm.evalAsString().find("est") != -1:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("*box*").filter("[shop_materialpath~=est]")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 35
0
    def test_get_first_child_with_type_name_has_ge_and_type_name_has_li_selected(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.type().name().find("ge") != -1 or i.type().name().find(
                    "li") != -1:
                selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("t#*ge* t#*li*")

        self.assertEqual(sel.get(0), selData[0])
Exemplo n.º 36
0
	def test_is_all_children_with_name_has_box_and_shoppath_has_est(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			parm = i.parm("shop_materialpath")
			if parm and i.name().find("box") != -1:
				if parm.evalAsString().find("est") != -1:
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("*box*").filter("[shop_materialpath~=est]")

		self.assertListEqual(sel._data, selData)
Exemplo n.º 37
0
    def test_is_all_children_with_tx_10_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            parm = i.parm("tx")
            if parm:
                if parm.eval() == 10:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("[tx=10]")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 38
0
    def test_is_all_children_with_attribute_scale_3_selected(self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            parm = i.parm("scale")
            if parm:
                if parm.eval() == 3:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("[scale=3]")

        self.assertListEqual(sel._data, selData)
Exemplo n.º 39
0
	def test_select_all_children_remove_all_type_name_light_add_back_light_with_name_has_box(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.type().name().find("light") == -1:
				selData.append(i)
			else:
				if i.name().find("box"):
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children().remove("t#light").addBack("*box*")
		self.assertListEqual(sel._data, selData)
Exemplo n.º 40
0
    def test_select_all_children_remove_all_type_name_light_add_back_light_with_name_has_box(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.type().name().find("light") == -1:
                selData.append(i)
            else:
                if i.name().find("box"):
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children().remove("t#light").addBack("*box*")
        self.assertListEqual(sel._data, selData)
Exemplo n.º 41
0
	def test_is_all_subchildren_with_siblings_to_facet_with_type_name_switch(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("facet") != -1:
				parent = i.parent()
				children = parent.children()
				for j in children:
					if j.type().name().find("switch") != -1:
						selData.append(j)

		sq = sQuery.sQuery()
		sel = sq.find("t#*facet*").siblings("t#switch")
		self.assertListEqual(sel._data, selData)
Exemplo n.º 42
0
	def test_is_all_children_with_name_has_sphere_and_shoppath_not(self):
		selData = []
		objPath = "/obj"
		shop_path = "/shop/mantrasurface_unique"
		for i in hou.node(objPath).children():
			parm = i.parm("shop_materialpath")
			if parm and i.name().find("sphere") != -1:
				if parm.evalAsString() != shop_path:
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("*sphere*").filter("[shop_materialpath!=%s]" %shop_path)

		self.assertListEqual(sel._data, selData)
Exemplo n.º 43
0
    def test_is_all_children_with_name_has_sphere_and_shoppath_not(self):
        selData = []
        objPath = "/obj"
        shop_path = "/shop/mantrasurface_unique"
        for i in hou.node(objPath).children():
            parm = i.parm("shop_materialpath")
            if parm and i.name().find("sphere") != -1:
                if parm.evalAsString() != shop_path:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("*sphere*").filter("[shop_materialpath!=%s]" %
                                             shop_path)

        self.assertListEqual(sel._data, selData)
Exemplo n.º 44
0
    def test_is_all_subchildren_with_siblings_to_facet_with_type_name_switch(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).allSubChildren():
            if i.type().name().find("facet") != -1:
                parent = i.parent()
                children = parent.children()
                for j in children:
                    if j.type().name().find("switch") != -1:
                        selData.append(j)

        sq = sQuery.sQuery()
        sel = sq.find("t#*facet*").siblings("t#switch")
        self.assertListEqual(sel._data, selData)
Exemplo n.º 45
0
	def test_is_all_children_with_name_has_sphere_and_shoppath_endswith_dom(self):
		# sq selection doesn't contain empty shop_materialpath attrs when it should
		selData = []
		objPath = "/obj"
		shop_path = "dom"
		for i in hou.node(objPath).children():
			parm = i.parm("shop_materialpath")
			if parm:
				if parm.evalAsString().endswith(shop_path) and i.name().find("sphere") != -1:
					selData.append(i)

		sq = sQuery.sQuery()
		sel = sq.children("*sphere*").filter("[shop_materialpath$=%s]" %shop_path)

		self.assertListEqual(sel._data, selData)
Exemplo n.º 46
0
	def test_select_for_all_subchildren_with_type_name_light_and_name_box(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("light") != -1 and i.name().find("box") != -1:
				i.setSelected(True)

		getSelected = list(hou.selectedNodes())
		for i in getSelected:
			i.setSelected(False)

		sq = sQuery.sQuery()
		sel = sq.find("t#*light*").filter("*box*").select()
		getSelectedSq = list(hou.selectedNodes())
		for i in getSelectedSq:
			i.setSelected(False)

		self.assertListEqual(getSelectedSq, getSelected)
Exemplo n.º 47
0
    def test_is_all_children_with_name_has_sphere_and_shoppath_endswith_dom(
            self):
        # sq selection doesn't contain empty shop_materialpath attrs when it should
        selData = []
        objPath = "/obj"
        shop_path = "dom"
        for i in hou.node(objPath).children():
            parm = i.parm("shop_materialpath")
            if parm:
                if parm.evalAsString().endswith(
                        shop_path) and i.name().find("sphere") != -1:
                    selData.append(i)

        sq = sQuery.sQuery()
        sel = sq.children("*sphere*").filter("[shop_materialpath$=%s]" %
                                             shop_path)

        self.assertListEqual(sel._data, selData)
Exemplo n.º 48
0
	def test_select_box1_from_viewport_selection(self):
		for i in hou.selectedNodes():
			i.setSelected(False)
			
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.name().find("box1") != -1 or i.name().find("box2") !=-1 or i.name().find("box3") != -1:
				i.setSelected(True)

		selected = list(hou.selectedNodes())

		sq = sQuery.sQuery()
		sel = sq.selection().filter("*box*")

		for i in selected:
			i.setSelected(False)

		self.assertListEqual(sel._data, selected)
Exemplo n.º 49
0
    def test_select_box1_from_viewport_selection(self):
        for i in hou.selectedNodes():
            i.setSelected(False)

        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).children():
            if i.name().find("box1") != -1 or i.name().find(
                    "box2") != -1 or i.name().find("box3") != -1:
                i.setSelected(True)

        selected = list(hou.selectedNodes())

        sq = sQuery.sQuery()
        sel = sq.selection().filter("*box*")

        for i in selected:
            i.setSelected(False)

        self.assertListEqual(sel._data, selected)
Exemplo n.º 50
0
    def test_select_for_all_subchildren_with_type_name_light_and_name_box(
            self):
        selData = []
        objPath = "/obj"
        for i in hou.node(objPath).allSubChildren():
            if i.type().name().find("light") != -1 and i.name().find(
                    "box") != -1:
                i.setSelected(True)

        getSelected = list(hou.selectedNodes())
        for i in getSelected:
            i.setSelected(False)

        sq = sQuery.sQuery()
        sel = sq.find("t#*light*").filter("*box*").select()
        getSelectedSq = list(hou.selectedNodes())
        for i in getSelectedSq:
            i.setSelected(False)

        self.assertListEqual(getSelectedSq, getSelected)
Exemplo n.º 51
0
 def test_is_shop_context_selected(self):
     sq = sQuery.sQuery("shop")
     self.assertEqual(sq._data[0], hou.node("/shop"))
Exemplo n.º 52
0
	def test_is_shop_context_selected(self):
		sq = sQuery.sQuery("shop")
		self.assertEqual(sq._data[0], hou.node("/shop"))
Exemplo n.º 53
0
 def test_is_obj_context_selected(self):
     sq = sQuery.sQuery("obj")
     self.assertEqual(sq._data[0], hou.node("/obj"))
Exemplo n.º 54
0
	def test_is_obj_context_selected(self):
		sq = sQuery.sQuery("obj")
		self.assertEqual(sq._data[0], hou.node("/obj"))