Notifications
Clear all

[Closed] deleteItem from point3Tab

Hi,

I have a problem modifying tab parameters from “inside” the plugin, which screams scope issue in my face but I’m sort of stuck. Calling the same function (fnDeleteItem) from within the onMouseDown event does invoke the tabChange event handler, but has no effect on the tab itself. Whereas calling it from “outside” works just fine.

Here’s an example:


(
	plugin simpleManipulator manipTest name:"Test" category:"Test" classID:#(0x24e63f49, 0x652cb098) (
		local colA = [0,0,1]
		local colB = [1,0,0]

		parameters main rollout:dlgParams (
			aPoint3Tab type:#point3Tab tabSize:0 tabSizeVariable:true
			p3Offset type:#point3 default:[0,0,0]
			
			on aPoint3Tab tabChanged change index count do format "Change: % 	 Index: %	 Total: %
" change index count
		)

		rollout dlgParams "Test" (
		)

		tool create (
			on mousePoint iClick do (
				if (iClick == 1) then nodeTM.translation = p3Offset = gridPoint
				else append aPoint3Tab (gridPoint - p3Offset)
			)

			on mouseAbort iClick do return #stop
		)

		function fnDeleteItem iItem = (
			deleteItem aPoint3Tab iItem
		)

		on canManipulate target return (classOf target == manipTest)

		on mouseDown m iGizmo do (
			if (keyboard.controlPressed) do fnDeleteItem (iGizmo + 1)
		)

		on updateGizmos do (
			this.clearGizmos()

			if (target != undefined) do (
				this.aPoint3Tab = target.aPoint3Tab
			)

			for nPoint in this.aPoint3Tab do (
				gizShape = manip.makeGizmoShape()
				gizShape.startNewLine()

				gizShape.addPoint (nPoint + [10,10,0])
				gizShape.addPoint (nPoint + [10,-10,0])
				gizShape.addPoint (nPoint + [-10,-10,0])
				gizShape.addPoint (nPoint + [-10,10,0])
				gizShape.addPoint (nPoint + [10,10,0])

				this.addGizmoShape gizShape 0 colA colB
			)

			return ""
		)
	)
)

This way it works fine:


$.fnDeleteItem 2

I checked the forums but there isn’t much on handling tab parameters. I also tried “deleteItem this.aPoint3Tab iItem” but that didn’t change anything.

Any help would be appreciated!
Max.

2 Replies

you have to delete item from paramblock of node (target), you are trying to delete from plugin defenition (this).

Thank you for the clarification, that makes sense now! And also solves another problem I sort of worked around.