intuitiv'3d API documentation Copyright ã1993 by Cub'x SystÜmes. All Rights Reserved.

CX3DGenericShaderInspector 

Inherits From:	View :Responder : Object

Declared In:	i3d/CX3DGenericShaderInspector.h

Class Description

By default,  the shader panel allocates a CX3DGenericShaderInspector to interact with a shader. CX3DGenericShaderInspector's instance asks the shader its parameters and build a user interface according to parameter types. The CX3DGenericShaderInspector is also an abstract super class that you have to use when you want to make a special interface for one or more parameters of a shader. You never use this class directly, you always make a subclass. The SkyInspector located in  Examples/AdvancedObject is an example of a CX3DGenericShaderInspector subclass.

In order to make a new shader inspector, you have to write the following things:

Allocating

	You must overload the + alloc method in order to load the nib file that you want to use. Note that an inspector inside intuitiv'3d only have one instance and this is your responsibility to ensure this. You generally want to use a class variable to store the instance address and built the instance only if this variable is equal to nil.

Defining your inspector responsibilities versus the CX3DGenericShaderInspector responsibilities.

	When building the interface, the CX3DGenericShaderInspector call the - shouldUseArg: method for all parameters to discover if it has to manage the parameter or if your subclass provides a better interface. You have to overload the - shouldUseArg: method to define which parameters your inspector takes in account.

	If you don't want a scale interface for your new inspector, you can overload the - shouldUseScale method and just returns NO inside it.

Building and unbuilding your interface 

	The CX3DGenericShaderInspector builds a list of views, that contains user interface controls, inside the initForShader: method. To add your own interface, you must overload the - makeInterfaceBeforeAllAt: method. 
	You also have to overload the - uninit method in order to remove views that you have added in the makeInterfaceBeforeAllAt: method.

Interaction with the inspected object

	Your new inspector provides some action connected using InterfaceBuilder with the new interface. Theses action methods should update the shader parameter concerned by the action and then call aValueHaveChange:.

Instance Variables

					               id interfaceList
  										id target
  										SEL action
  										id shader
  										BOOL useDispBound
  										CXArg dispBound

interfaceList 	This list contains all the interface views displayed for the shader.

target 	The target of the inspector is an object that should be informed when a value have change. It is usually the shader panel.

action	The selector of the method that is to be used to inform the target that a value have change.

shader	This instance variable contains the current shader that is inspected.

useDispBound	If this flag is set to YES, the inspector should add an interface to control the displacement bound parameter. This is used currently for displacement shaders.

dispBound	This variable only exists to use the same interface objects to interact with the displacement bound than the interface used to interact with a shader argument

Method Types

Allocating, initializing and freeing	
	+ alloc 
	- free
	- initForShader: 

Target and action
	- setTarget
	- target
	- setAction:
	- action
	- aValueHaveChange:

Methods implemented by the subclass

	- uninit
	- shouldUseArg:
	- shouldUseScale
	- makeInterfaceBeforeAllAt:

Class Methods

alloc
	+ alloc
This method allocates a new instance of CX3DGenericShaderInspector. As for all inspectors inside intuitiv'3d, there is only one instance. You can use this method to load the nib needed by your inspector. 

See also: The class SkyInspector in Examples/AdvancedObject

Instance Methods
action
	- action
This method returns the value of the action instance variable. 

See also:  - target, - setTarget: , - setAction

aValueHaveChange:
					- aValueHaveChange: sender

					You don't have to overload this method but you must call it with self as argument when one of your action method (connected with your interface inside InterfaceBuilder) is called. The implementation of this method call the target to inform the shader panel that a value has changed.

See also:  - target, - setTarget: , action, - setAction

	- action
This method returns the value of the action instance variable. 

See also:  - target, - setTarget: , - setAction

free
			- free
Since there is only one instance of the CX3DGenericShaderInspector, this method does nothing and returns self.

initForShader:
	- initForShader: aShader
This method is called by the shader panel when a new shader well is focused or when a new shader is dropped into the focused shader well. For each parameters of the shader, this method builds an interface if the call - shouldUseArg: on itself returns YES. You never call this method directly.

See also:  - shouldUseArg:

makeInterfaceBeforeAllAt:
	- makeInterfaceBeforeAllAt:(NXCoord*) py
This method should add the interface view that you want to add to the default interface. py contains the current X / Y coordinates that you should use to place your new view. You must update the content's value of py. To do this, just add to the Y component the height of your new view and the constant DEFAULT_OFFSET.  The constant  DEFAULT_OFFSET is defined into CX3DGenericShaderInspector.h.

See also:  - addSubview (view), - uninit , The class SkyInspector in Examples/AdvancedObject

setAction:
	- setAction: (SEL) aSelector
This method sets the value of the action instance variable. This variable should contain the selector of the method that is used to inform the target that a value has changed in the interface.

See also:  - target, - setTarget: , - action

setTarget:
	- setTarget: anObject
This method sets the value of the target instance variable. This variable should contain the id of the object that has to be be informed of a value change in the interface.

See also:  - target, - setAction: , - action

shouldUseArg:
	- (BOOL)shouldUseArg:(unsigned int) argNum
This method should return YES if the shader parameter defined by argNum should be managed by the CX3DGenericShaderInspector and should return NO if you provide a new interface for the parameter or if you don't want any interface for the parameter. argNum is the parameter index  from 0 to n - 1 where n is the number of parameter of the shader.

shouldUseScale
	- (BOOL)shouldUseScale
This method should return YES if you want a scale interface for your shader and NO otherwise.

target:
	- target
This method returns the value of the target instance variable.

See also:  -  setTarget, - setAction: , - action

uninit:
	- uninit
This method should call removeFromSupeview on all views added by your implementation of  makeInterfaceBeforeAllAt:

See also:  -  makeInterfaceBeforeAllAt: , removeFromSuperview (View)