Example #1
0
    def execute(self, context):
        print("CALCULATE")
        # getIslands(context.object)
        s = bpy.context.scene
        o = s.cam_operations[s.cam_active_operation]

        bpy.ops.object.select_all(action='DESELECT')
        path = bpy.data.objects.get('cam_path_{}'.format(o.name))
        if path:
            path.select_set(state=True)
            bpy.ops.object.delete()

        if not o.valid:
            self.report({'ERROR_INVALID_INPUT'}, "Operation can't be performed, see warnings for info")
            print("Operation can't be performed, see warnings for info")
            return {'FINISHED'}

        if o.computing:
            return {'FINISHED'}

        o.operator = self

        if o.use_layers:
            o.parallel_step_back = False



        utils.getPath(context, o)

        return {'FINISHED'}
Example #2
0
	def execute(self, context):
		#getIslands(context.object)
		s=bpy.context.scene
		o = s.cam_operations[s.cam_active_operation]
		
		if not o.valid:
				self.report({'ERROR_INVALID_INPUT'}, "Operation can't be performed, see warnings for info")
				#print("Operation can't be performed, see warnings for info")
				return {'FINISHED'}
		if o.computing:
			return {'FINISHED'}
		
		o.operator=self
		
		if o.use_layers:
			o.parallel_step_back = False
			
		utils.getPath(context,o)
		
		return {'FINISHED'}
Example #3
0
	def execute(self, context):
		#getIslands(context.object)
		s=bpy.context.scene
		o = s.cam_operations[s.cam_active_operation]
		
		if not o.valid:
				self.report({'ERROR_INVALID_INPUT'}, "Operation can't be performed, see warnings for info")
				#print("Operation can't be performed, see warnings for info")
				return {'FINISHED'}
		if o.computing:
			return {'FINISHED'}
		
		o.operator=self
		
		if o.use_layers:
			o.parallel_step_back = False
			
		utils.getPath(context,o)
		
		return {'FINISHED'}
Example #4
0
def testOperation(i):

    s = bpy.context.scene
    o = s.cam_operations[i]
    report = ''
    report += 'testing operation ' + o.name + '\n'

    utils.getPath(bpy.context, o)

    newresult = bpy.data.objects[o.path_object_name]
    origname = "test_cam_path_" + o.name
    if origname not in s.objects:
        report += 'operation test has nothing to compare with, making the new result as comparable result.\n\n'
        newresult.name = origname
    else:
        testresult = bpy.data.objects[origname]
        m1 = testresult.data
        m2 = newresult.data
        test_ok = True
        if len(m1.vertices) != len(m2.vertices):
            report += "vertex counts don't match\n\n"
            test_ok = False
        else:
            different_co_count = 0
            for i in range(0, len(m1.vertices)):
                v1 = m1.vertices[i]
                v2 = m2.vertices[i]
                if v1.co != v2.co:
                    different_co_count += 1
            if different_co_count > 0:
                report += 'vertex position is different on %i vertices \n\n' % (
                    different_co_count)
                test_ok = False
        if test_ok:
            report += 'test ok\n\n'
        else:
            report += 'test result is different\n \n '
    print(report)
    return report
def testOperation(i):
	
	s=bpy.context.scene
	o = s.cam_operations[i]
	report=''
	report+='testing operation '+ o.name+ '\n'
	
	utils.getPath(bpy.context,o)
		
	newresult=bpy.data.objects[o.path_object_name]
	origname="test_cam_path_"+o.name
	if origname not in s.objects:
		report+='operation test has nothing to compare with, making the new result as comparable result.\n\n'
		newresult.name = origname
	else:
		testresult = bpy.data.objects[origname]
		m1 = testresult.data
		m2 = newresult.data
		test_ok=True
		if len(m1.vertices) != len(m2.vertices):
			report += "vertex counts don't match\n\n"
			test_ok = False
		else:
			different_co_count=0
			for i in range(0,len(m1.vertices)):
				v1=m1.vertices[i]
				v2=m2.vertices[i]
				if v1.co != v2.co:
					different_co_count+=1
			if different_co_count>0:
				report += 'vertex position is different on %i vertices \n\n' % (different_co_count)
				test_ok = False
		if test_ok:
			report += 'test ok\n\n'
		else:
			report += 'test result is different\n \n '
	print(report)
	return report