kbot flowers | commons | registry ref

This commit is contained in:
Code 2025-02-14 20:11:16 +01:00
parent 75c14e3865
commit 3c4d8bc122
23 changed files with 4489 additions and 0 deletions

View File

@ -0,0 +1,209 @@
# @plastichub/kbot
AI-powered command-line tool for code modifications and project management that supports multiple AI models and routers.
## Overview
Code-bot is a powerful CLI tool that helps developers automate code modifications, handle project management tasks, and integrate with various AI models for intelligent code and content assistance.
## Quick Start
### Installation Steps
KBot requires Node.js to run. It's recommended to use Node.js version 18 or higher.
1. Visit the official [Node.js website](https://nodejs.org/)
2. Download the LTS (Long Term Support) version for your operating system
3. Follow the installation wizard
4. Verify installation by opening a terminal and running:
```bash
node --version
npm --version
```
### API Keys
KBot supports both OpenRouter and OpenAI APIs. You'll need at least one of these set up.
#### OpenRouter API (Recommended)
1. Visit [OpenRouter](https://openrouter.ai/)
2. Sign up for an account
3. Navigate to the API Keys section
4. Create a new API key
#### OpenAI API (Optional)
1. Go to [OpenAI's platform](https://platform.openai.com/)
2. Create an account or sign in
3. Navigate to API keys section
4. Create a new secret key
### Installation using Node NPM package manager
```bash
npm install -g @plastichub/kbot
```
## Configuration
### API Keys Setup
Create configuration at `$HOME/.osr/.config.json` (or export OSR_CONFIG with path to config.json):
```json
{
"openrouter": {
"key": "your-openrouter-key"
},
"openai": {
"key": "your-openai-key"
},
"email": {
"newsletter": {
"host": "host.org",
"port": 465,
"debug": true,
"transactionLog": true,
"auth": {
"user": "foo@bar.com",
"pass": "pass"
}
}
},
"google": {
"cse": "custom search engine id",
"api_key": "google custom search api key"
},
"serpapi": {
"key": "your SerpAPI key (optional, used for web searches(places, google maps))"
},
"deepseek": {
"key": "your SerpAPI key (optional, used for web searches(places, google maps))"
},
}
```
### Preferences Setup
Optionally, create `.kbot/preferences.md` in your project directory to customize AI interactions:
```markdown
## My Preferences
Gender : male
Location : New York, USA (eg: `send me all saunas next to me`)
Language : English
Occupation : software developer, Typescript
Age : 30+
## Contacts
My email address : example@email.com (eg: `send me latest hacker news`)
My wife's email address ("Anne") : example@email.com (eg: `send email to my wife, with latest local news')
## Content
When creating content
- always Markdown
- always add links
- when sending emails, always add 'Best regards, [Your Name]'
```
## Commands
### Prompt
```kbot "create Astro minimal boilerplate, use starlight theme. Install dependencies via NPM tool"```
### Fetch latest models
```kbot fetch```
### Print examples
```kbot examples```
### Print extended help
```kbot help-md```
### Initialize folder
```kbot init```
# Command Line Parameters
This document describes all available command line parameters.
## Core Parameters
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| `path` | Target directory | `.` | No |
| `prompt` | The prompt. Supports file paths and environment variables | `./prompt.md` | No |
| `output` | Optional output path for modified files (Tool mode only) | - | No |
| `dst` | Optional destination path for the result, will substitute ${MODEL} and ${ROUTER} in the path. | - | No |
| `model` | AI model to use for processing | `anthropic/claude-3.5-sonnet` | No |
| `router` | Router to use: openai or openrouter | `openrouter` | No |
| `mode` | Chat completion mode: "completion" (without tools) or "tools" | `tools` | No |
## Advanced Parameters
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| `each` | Target directory | `.` | No |
| `dry` | Dry run - only write out parameters without making API calls | `false` | No |
## File Selection & Tools
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| `include` | Glob patterns to match files for processing. Supports multiple patterns, e.g. `--include=src/*.tsx,src/*.ts --include=package.json` | - | No |
| `disable` | Disable tools categories | `[]` | No |
| `disableTools` | List of specific tools to disable | `[]` | No |
## Configuration & Profiles
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| `profile` | Path to profile for variables. Supports environment variables | `${POLYMECH-ROOT}/profile.json` | No |
| `env` | Environment (in profile) | `default` | No |
| `config` | Path to JSON configuration file (API keys). Supports environment variables | - | No |
| `preferences` | Path to preferences file (location, email, gender, etc). Supports environment variables | `./.kbot/preferences.md` | No |
## Debugging & Logging
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| `logLevel` | Logging level for the application (0-4) | `2` | No |
| `logs` | Logging directory | `./.kbot` | No |
| `dump` | Create a script | - | No |
# Working on Larger Directories
Since LLMs (Large Language Models) and providers are limited to very small 'context windows', it's necessary to feed them with smaller chunks instead. This document explains how to process larger directories efficiently.
## Directory Processing Example
Here's an example of how to walk through files and process them:
```bash
osr-cli each --main='kbot \"read ${KEY} and translate to german, save in docs/language code/filename.md\" --include=\"${REL}\" --include=\".kbot/preferences.md\"' --list="./docs/*.md" --cwd=.
```
### Parameter Explanation
- `each`: Command to process multiple files iteratively
- `--main`: The main command (`kbot`) to execute for each file
- `--include=\"${REL}\"` instructs kbot to include the current selected path
- `--include=\".kbot/preferences.md\"` instructs kbot to include additional preferences about the task (eg: translation specifics)
- `--list`: Specifies the file pattern to match
- Supports include patterns (e.g., `"./docs/*.md"`)
- `--cwd`: Sets the current working directory for the command execution. Default is the current directory (`.`)
**Note** requires `@plastichub/osr-cli-commons` to be installed globally:
```bash
npm i -g @plastichub/osr-cli-commons
```

View File

@ -0,0 +1,3 @@
kbotd --prompt="./.kbot/docs.md"

View File

@ -0,0 +1,10 @@
kbotd modify \
--path=. \
--prompt="./.kbot/todos.md" \
--mode=completion \
--router2=openai \
--model=openai/gpt-4-32k \
--include2="src/commands/run.ts" \
--include2="src/commands/run-tools.ts" \
--disable="npm,terminal,git,user,search,email" \
--dst="./.kbot/todos-log.md"

View File

@ -0,0 +1,743 @@
/**************************************************************************/
/* File : CKBaseManager.h */
/* Author : Romain Sididris */
/* */
/* Base Class for Virtools Managers */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKBASEMANAGER_H
#define CKBASEMANAGER_H "$Id:$"
#include "CKDefines.h"
class CKFile;
class CKStateChunk;
#define MAX_MANAGERFUNC_PRIORITY 30000
#define DEFAULT_MANAGERFUNC_PRIORITY 0
/*************************************************
Summary: Mask for Base Manager overridable functions.
Remarks:
+ When implementing a manager the CKBaseManager::GetValidFunctionsMask
must be overriden to return a combination of these flag to indicate
which methods are implemented.
See also: CKBaseManager,CKBaseManager::GetValidFunctionsMask
*************************************************/
typedef enum CKMANAGER_FUNCTIONS {
CKMANAGER_FUNC_OnSequenceToBeDeleted = 0x00000001, // CKBaseManager::OnSequenceToBeDeleted
CKMANAGER_FUNC_OnSequenceDeleted = 0x00000002, // CKBaseManager::OnSequenceDeleted
CKMANAGER_FUNC_PreProcess = 0x00000004, // CKBaseManager::PreProcess
CKMANAGER_FUNC_PostProcess = 0x00000008, // CKBaseManager::PostProcess
CKMANAGER_FUNC_PreClearAll = 0x00000010, // CKBaseManager::PreClearAll
CKMANAGER_FUNC_PostClearAll = 0x00000020, // CKBaseManager::PostClearAll
CKMANAGER_FUNC_OnCKInit = 0x00000040, // CKBaseManager::OnCKInit
CKMANAGER_FUNC_OnCKEnd = 0x00000080, // CKBaseManager::OnCKEnd
CKMANAGER_FUNC_OnCKPlay = 0x00000100, // CKBaseManager::OnCKPlay
CKMANAGER_FUNC_OnCKPause = 0x00000200, // CKBaseManager::OnCKPause
CKMANAGER_FUNC_PreLoad = 0x00000400, // CKBaseManager::PreLoad
CKMANAGER_FUNC_PreSave = 0x00000800, // CKBaseManager::PreSave
CKMANAGER_FUNC_PreLaunchScene = 0x00001000, // CKBaseManager::PreLaunchScene
CKMANAGER_FUNC_PostLaunchScene = 0x00002000, // CKBaseManager::PostLaunchScene
CKMANAGER_FUNC_OnCKReset = 0x00004000, // CKBaseManager::OnCKReset
CKMANAGER_FUNC_PostLoad = 0x00008000, // CKBaseManager::PostLoad
CKMANAGER_FUNC_PostSave = 0x00010000, // CKBaseManager::PostSave
CKMANAGER_FUNC_OnCKPostReset = 0x00020000, // CKBaseManager::OnCKPostReset
CKMANAGER_FUNC_OnSequenceAddedToScene = 0x00040000, // CKBaseManager::OnSequenceAddedToScene
CKMANAGER_FUNC_OnSequenceRemovedFromScene = 0x00080000, // CKBaseManager::OnSequenceRemovedFromScene
CKMANAGER_FUNC_OnPreCopy = 0x00100000, // CKBaseManager::OnPreCopy
CKMANAGER_FUNC_OnPostCopy = 0x00200000, // CKBaseManager::OnPostCopy
CKMANAGER_FUNC_OnPreRender = 0x00400000, // CKBaseManager::OnPreRender
CKMANAGER_FUNC_OnPostRender = 0x00800000, // CKBaseManager::OnPostRender
CKMANAGER_FUNC_OnPostSpriteRender = 0x01000000, // CKBaseManager::OnPostSpriteRender
CKMANAGER_FUNC_OnPreBackToFront = 0x02000000, // CKBaseManager::OnPreBackToFront
CKMANAGER_FUNC_OnPostBackToFront = 0x04000000, // CKBaseManager::OnPostBackToFront
CKMANAGER_FUNC_OnPreFullScreen = 0x08000000, // CKBaseManager::OnPreFullScreen
CKMANAGER_FUNC_OnPostFullScreen = 0x10000000, // CKBaseManager::OnPostFullScreen
CKMANAGER_FUNC_OnRasterizerEvent = 0x20000000, // CKBaseManager::OnRasterizerEvent
CKMANAGER_FUNC_OnPreSpriteRender = 0x40000000 // CKBaseManager::OnPreSpriteRender
} CKMANAGER_FUNCTIONS;
typedef enum CKMANAGER_FUNCTIONS_INDEX {
CKMANAGER_INDEX_OnSequenceToBeDeleted = 0,
CKMANAGER_INDEX_OnSequenceDeleted = 1,
CKMANAGER_INDEX_PreProcess = 2,
CKMANAGER_INDEX_PostProcess = 3,
CKMANAGER_INDEX_PreClearAll = 4,
CKMANAGER_INDEX_PostClearAll = 5,
CKMANAGER_INDEX_OnCKInit = 6,
CKMANAGER_INDEX_OnCKEnd = 7,
CKMANAGER_INDEX_OnCKPlay = 8,
CKMANAGER_INDEX_OnCKPause = 9,
CKMANAGER_INDEX_PreLoad = 10,
CKMANAGER_INDEX_PreSave = 11,
CKMANAGER_INDEX_PreLaunchScene = 12,
CKMANAGER_INDEX_PostLaunchScene = 13,
CKMANAGER_INDEX_OnCKReset = 14,
CKMANAGER_INDEX_PostLoad = 15,
CKMANAGER_INDEX_PostSave = 16,
CKMANAGER_INDEX_OnCKPostReset = 17,
CKMANAGER_INDEX_OnSequenceAddedToScene = 18,
CKMANAGER_INDEX_OnSequenceRemovedFromScene = 19,
CKMANAGER_INDEX_OnPreCopy = 20,
CKMANAGER_INDEX_OnPostCopy = 21,
CKMANAGER_INDEX_OnPreRender = 22,
CKMANAGER_INDEX_OnPostRender = 23,
CKMANAGER_INDEX_OnPostSpriteRender = 24,
CKMANAGER_INDEX_OnPreBackToFront = 25,
CKMANAGER_INDEX_OnPostBackToFront = 26,
CKMANAGER_INDEX_OnPreFullScreen = 27,
CKMANAGER_INDEX_OnPostFullScreen = 28,
CKMANAGER_INDEX_OnRasterizerEvent = 29,
CKMANAGER_INDEX_OnPreSpriteRender = 30,
} CKMANAGER_FUNCTIONS_INDEX;
/*************************************************************************
Summary: Base Class for managers.
Remarks:
+ This class provides virtual methods that can be override by any managers. Any manager that inherits from CKBaseManager can override function to do some processing.
+ The instances of managers may be retrieved through the global function CKContext::GetManagerByGuid()
+ Some default managers implemented in Virtools can be accessed directly : See Managers Access
See also: CKContext::RegisterNewManager,Implementing a external Manager
*************************************************************************/
class CKBaseManager {
public:
CKBaseManager(CKContext *Context,CKGUID guid,CKSTRING Name);
virtual ~CKBaseManager();
/*************************************************
Summary: Acces to Manager GUID
Return Value:
CKGUID of this manager.
Remarks:
+ Each Manager is given an unique GUID. When creating a new manager it should
assign itself a GUID and name before registering itsef.
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
CKAttributeManager::CKAttributeManager(CKContext *Context):CKBaseManager(Context,ATTRIBUTE_MANAGER_GUID,"Attribute Manager")
{
....
....
Context->RegisterNewManager(this);
}
{html:</td></tr></table>}
See Also: CKContext::RegisterNewManager,GetName
*************************************************/
CKGUID GetGuid() { return m_ManagerGuid; }
/*************************************************
Summary: Acces to Manager name
Return Value:
Name of this manager.
Remarks:
+ Each Manager can be given a name. When creating a new manager it should
assign itself a GUID and name before registering itsef.
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
CKAttributeManager::CKAttributeManager(CKContext *Context):CKBaseManager(Context,ATTRIBUTE_MANAGER_GUID,"Attribute Manager")
{
....
....
Context->RegisterNewManager(this);
}
{html:</td></tr></table>}
See Also: CKContext::RegisterNewManager,GetGuid
*************************************************/
CKSTRING GetName() { return m_ManagerName; }
/*************************************************
Summary: Called to save manager data.
Arguments:
SavedFile: A pointer to the CKFile being saved.
Return Value:
This function should return a valid CKStateChunk that contain data to save or NULL if there is nothing to save.
Remarks:
+ During a save operation, each manager is given the opportunity to save its data in the file.
+ The file being saved is given for information only and must not be modified. It can be used to decide whether it is worth saving
data for your manager.
See Also: CKStateChunk,LoadData
*************************************************/
virtual CKStateChunk* SaveData(CKFile* SavedFile) { return NULL; }
/*************************************************
Summary: Called to load manager data.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
chunk: A pointer to a CKStateChunk that was saved in the file.
LoadedFile: A pointer to the CKFile being loaded.
Remarks:
+ During a load operation, each manager is automatically called if there was a chunk saved in the file with SaveData.
See Also: CKStateChunk,SaveData
*************************************************/
virtual CKERROR LoadData(CKStateChunk *chunk,CKFile* LoadedFile) { return CK_OK; }
/*************************************************
Summary: Called at the beginning of a CKContext::ClearAll operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the beginning of a CKContext::ClearAll operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PreClearAll for this function to get called.
See Also:Main Virtools Events,PostClearAll,CKContext::ClearAll
*************************************************/
virtual CKERROR PreClearAll() { return CK_OK; }
/*************************************************
Summary: Called at the end of a CKContext::ClearAll operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the end of a CKContext::ClearAll operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PostClearAll for this function to get called.
See Also:Main Virtools Events,PreClearAll,CKContext::ClearAll,
*************************************************/
virtual CKERROR PostClearAll() { return CK_OK; }
/*************************************************
Summary: Called at the beginning of each process loop.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the beginning of a CKContext::Process operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PreProcess for this function to get called.
See Also:Main Virtools Events,PostProcess,CKContext::Process,
*************************************************/
virtual CKERROR PreProcess() { return CK_OK; }
/*************************************************
Summary: Called at the end of each process loop.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the end of a CKContext::Process operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PostProcess for this function to get called.
See Also:Main Virtools Events,PreProcess,CKContext::Process,
*************************************************/
virtual CKERROR PostProcess() { return CK_OK; }
/*************************************************
Summary: Called when objects are added to a scene
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
scn: A pointer to the CKScene to which objects where added.
objids: A pointer to a list of CK_ID of the objects being added to the scene.
count: number of objects in objids list.
Remarks:
+ You can override these functions to add specific processing when adding or removing objects from scene
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnSequenceAddedToScene for this function to get called.
See Also:Main Virtools Events,SequenceRemovedFromScene
*************************************************/
virtual CKERROR SequenceAddedToScene(CKScene *scn,CK_ID *objids,int count) { return CK_OK; }
/*************************************************
Summary: Called when objects are removed from a scene
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
scn: A pointer to the CKScene to which objects where added.
objids: A pointer to a list of CK_ID of the objects being added to the scene.
count: number of objects in objids list.
Remarks:
+ You can override these functions to add specific processing when adding or removing objects from scene
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnSequenceRemovedFromScene for this function to get called.
See Also:Main Virtools Events,SequenceAddedToScene,
*************************************************/
virtual CKERROR SequenceRemovedFromScene(CKScene *scn,CK_ID *objids,int count){ return CK_OK; }
/*************************************************
Summary: Called before a scene becomes active.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
OldScene: Previous active scene.
NewScene: Scene to become active.
Remarks:
+ You can override these functions to add specific processing at the beginning and at the end of a LaunchScene operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PreLaunchScene for this function to get called.
See Also:Main Virtools Events,PostLaunchScene,
*************************************************/
virtual CKERROR PreLaunchScene(CKScene* OldScene,CKScene* NewScene) { return CK_OK; }
/*************************************************
Summary: Called after a scene became active.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
OldScene: Previous active scene.
NewScene: Scene that have been activated.
Remarks:
+ You can override these functions to add specific processing at the beginning and at the end of a LaunchScene operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PostLaunchScene for this function to get called.
See Also:Main Virtools Events,PreLaunchScene
*************************************************/
virtual CKERROR PostLaunchScene(CKScene* OldScene,CKScene* NewScene) { return CK_OK; }
/*************************************************
Summary: Called at the end of the creation of a CKContext.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function if you need to add specific processing at initialization.
+ If your manager is registered after the context has been created and if it implements the OnCKInit()
function then, this function will be called upon registration.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKInit for this function to get called.
See Also:Main Virtools Events,OnCKEnd,CKCreateContext
*************************************************/
virtual CKERROR OnCKInit() { return CK_OK; }
/*************************************************
Summary: Called at deletion of a CKContext
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function if you need to clean up things at the end of the session.
+ This method is called at the beginning of the deletion of the CKContext, the manager
is also deleted a short time after.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKEnd for this function to get called.
See Also:Main Virtools Events,OnCKInit,CKCloseContext
*************************************************/
virtual CKERROR OnCKEnd() { return CK_OK; }
/*************************************************
Summary: Called before the composition is reset.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKReset for this function to get called.
See Also:Main Virtools Events,CKContext::Reset,OnCKPostReset,OnCKPause,OnCKPlay.
*************************************************/
virtual CKERROR OnCKReset() { return CK_OK; }
/*************************************************
Summary: Called after the composition has been restarted.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKPostReset for this function to get called.
See Also:Main Virtools Events ,CKContext::Reset,OnCKReset,OnCKPause,OnCKPlay.
*************************************************/
virtual CKERROR OnCKPostReset() { return CK_OK; }
/*************************************************
Summary: Called when the process loop is paused.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKPause for this function to get called.
See Also:Main Virtools Events,CKContext::Reset,OnCKReset,OnCKPostReset,OnCKPlay.
*************************************************/
virtual CKERROR OnCKPause() { return CK_OK; }
/*************************************************
Summary: Called when the process loop is started .
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnCKPlay for this function to get called.
See Also:Main Virtools Events,CKContext::Reset,OnCKReset,OnCKPostReset,OnCKPause.
*************************************************/
virtual CKERROR OnCKPlay() { return CK_OK; }
/*************************************************
Summary: Called just before objects are deleted.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
objids: A pointer to a list of CK_ID of the objects being deleted.
count: number of objects in objids list.
Remarks:
+ You can override this function if you need to add specific processing before objects are deleted.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnSequenceToBeDeleted for this function to get called.
See Also:Main Virtools Events,CKContext::DestroyObjects,SequenceDeleted
*************************************************/
virtual CKERROR SequenceToBeDeleted(CK_ID *objids,int count) { return CK_OK; }
/*************************************************
Summary: Called after objects have been deleted.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
objids: A pointer to a list of CK_ID of the objects being deleted.
count: number of objects in objids list.
Remarks:
+ You can override this function if you need to add specific processing after objects have been deleted.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnSequenceDeleted for this function to get called.
See Also:Main Virtools Events,CKContext::DestroyObjects,SequenceToBeDeleted
*************************************************/
virtual CKERROR SequenceDeleted(CK_ID *objids,int count) { return CK_OK; }
/*************************************************
Summary: Called at the beginning of a load operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the beginning of a load operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PreLoad for this function to get called.
See Also:Main Virtools Events,PreSave,PostSave,PostLoad,CKContext::Load
*************************************************/
virtual CKERROR PreLoad() { return CK_OK; }
/*************************************************
Summary: Called at the end of a load operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the end of a load operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PostLoad for this function to get called.
See Also:Main Virtools Events,PreSave,PostSave,PreLoad,CKContext::Load
*************************************************/
virtual CKERROR PostLoad() { return CK_OK; }
/*************************************************
Summary: Called at the beginning of a save operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the beginning of a save operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PreSave for this function to get called.
See Also:Main Virtools Events,PreSave,PostSave,PreLoad,CKContext::Load
*************************************************/
virtual CKERROR PreSave() { return CK_OK; }
/*************************************************
Summary: Called at the end of a save operation.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing at the end of a save operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_PostSave for this function to get called.
See Also:Main Virtools Events,PreSave,PostSave,PreLoad,CKContext::Load
*************************************************/
virtual CKERROR PostSave() { return CK_OK; }
/*************************************************
Summary: Called at the beginning of a copy.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
context: A CKDependenciesContext containing the objects being copied.
Remarks:
+ You can override this function to add specific processing at the beginning of a copy operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPreCopy for this function to get called.
See Also:Main Virtools Events,OnPostCopy,CKContext::CopyObjects
*************************************************/
virtual CKERROR OnPreCopy(CKDependenciesContext& context) { return CK_OK; }
/*************************************************
Summary: Called at the end of a copy.
Return Value:
CK_OK if successful or an error code otherwise.
Arguments:
context: A CKDependenciesContext containing the objects being copied.
Remarks:
+ You can override this function to add specific processing at the beginning of a copy operation.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostCopy for this function to get called.
See Also:Main Virtools Events,OnPreCopy,CKContext::CopyObjects
*************************************************/
virtual CKERROR OnPostCopy(CKDependenciesContext& context) { return CK_OK; }
/*************************************************
Summary: Called before the rendering of the 3D objects.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing before the rendering of the scene occured.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPreRender for this function to get called.
See Also:OnPostRender,OnPostSpriteRender,CKRenderContext::Render,Understanding the Render Loop
*************************************************/
virtual CKERROR OnPreRender(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called after the rendering of the 3D objects .
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing after the rendering of the 3D scene occured.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostRender for this function to get called.
See Also:OnPreRender,OnPostSpriteRender,CKRenderContext::Render,Understanding the Render Loop
*************************************************/
virtual CKERROR OnPostRender(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called Before the rendering of background 2D entities.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing before the rendering of the background 2D entities occured.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostSpriteRender for this function to get called.
See Also:OnPostRender,OnPreRender,CKRenderContext::Render,Understanding the Render Loop
*************************************************/
virtual CKERROR OnPreSpriteRender(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called after the rendering of foreground 2D entities.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing after the rendering of the foreground 2D entities occured.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostSpriteRender for this function to get called.
See Also:OnPostRender,OnPreRender,CKRenderContext::Render,Understanding the Render Loop
*************************************************/
virtual CKERROR OnPostSpriteRender(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Returns the priority of the specified manager function.
Arguments:
Function: A CKMANAGER_FUNCTIONS to get the priority of.
Return Value: A integer giving priority for the specified function.
Remarks:
+ Override this function if you want to specify a priority for one or several functions of your manager.
+ The default implementation returns a priority of 0 for all functions.
Example:
// To ensure that your PostProcess() function will be one of the first to be called amongst all managers:
int MyManager::GetFunctionPriority(CKMANAGER_FUNCTIONS Function)
{
if (Function==CKMANAGER_FUNC_PostProcess) return 10000; // High Priority
return 0;
}
See Also: CKMANAGER_FUNCTIONS
*************************************************/
virtual int GetFunctionPriority(CKMANAGER_FUNCTIONS Function) { return 0; }
/*************************************************
Summary: Returns list of functions implemented by the manager.
Return Value: A combination of CKMANAGER_FUNCTIONS.
Remarks.
+ You must override this function to indicate which functions your manager implements.
Example:
// The attribute manager implements four CKBaseManager functions :PreClearAll,PostLoad,OnSequenceAddedToscene
// and OnSequenceRemovedFromScene so its GetValidFunctionsMask looks like this:
virtual CKDWORD GetValidFunctionsMask() { return CKMANAGER_FUNC_PreClearAll |
CKMANAGER_FUNC_PostLoad |
CKMANAGER_FUNC_OnSequenceAddedToScene |
CKMANAGER_FUNC_OnSequenceRemovedFromScene; }
See Also: CKMANAGER_FUNCTIONS
*************************************************/
virtual CKDWORD GetValidFunctionsMask() { return 0; }
/*************************************************
Summary: Called before the backbuffer is presented.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing before the backbuffer is presented.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPreBackToFront for this function to get called.
See Also:OnPostBackToFront,CKRenderContext::Render,Understanding the Render Loop,GetValidFunctionsMask
*************************************************/
virtual CKERROR OnPreBackToFront(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called after the backbuffer is presented.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing after the backbuffer is presented.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostBackToFront for this function to get called.
See Also:OnPreBackToFront,CKRenderContext::Render,Understanding the Render Loop,GetValidFunctionsMask
*************************************************/
virtual CKERROR OnPostBackToFront(CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called before switching to/from fullscreen.
Arguments:
Going2Fullscreen: TRUE if we are going to fullscreen , FALSE if returning to windowed mode.
dev: A Pointer to the CKRenderContext that is currently changing mode.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing before a context switch to/from fullscreen.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPreFullScreen for this function to get called.
See Also:OnPreBackToFront,CKRenderContext::Render,Understanding the Render Loop,GetValidFunctionsMask
*************************************************/
virtual CKERROR OnPreFullScreen(BOOL Going2Fullscreen, CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called after switching to/from fullscreen.
Arguments:
Going2Fullscreen: TRUE if we are going to fullscreen , FALSE if returning to windowed mode.
dev: A Pointer to the CKRenderContext that has just changed of video mode.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing after a context switch to/from fullscreen.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnPostFullScreen for this function to get called.
See Also:OnPreBackToFront,CKRenderContext::Render,Understanding the Render Loop,GetValidFunctionsMask
*************************************************/
virtual CKERROR OnPostFullScreen(BOOL Going2Fullscreen,CKRenderContext* dev) { return CK_OK; }
/*************************************************
Summary: Called for specific rasterizer events.
Arguments:
Event: Event that was sent by the rasterizer.
dev: A Pointer to the CKRenderContext that has just changed of video mode.
Return Value:
CK_OK if successful or an error code otherwise.
Remarks:
+ You can override this function to add specific processing when a render context
is created/destroyed or resized.
+ According to implementation (DirectX , OpenGL,etc.) some events can occur
such as LostDevice with DirectX that you might need to handle when directly using
DirectX objects in a manager.
+ You must override GetValidFunctionsMask and return a value including
CKMANAGER_FUNC_OnRasterizerEvent for this function to get called.
See Also:CKRenderContext::Render,Understanding the Render Loop,GetValidFunctionsMask
*************************************************/
virtual CKERROR OnRasterizerEvent(CKRST_EVENTS Event,CKRenderContext* dev) { return CK_OK; }
CKERROR CKDestroyObject(CKObject *obj,DWORD Flags=0,CKDependencies* depoptions=NULL);
CKERROR CKDestroyObject(CK_ID id,DWORD Flags=0,CKDependencies* depoptions=NULL);
CKERROR CKDestroyObjects(CK_ID* obj_ids,int Count,DWORD Flags=0,CKDependencies* depoptions=NULL);
CKObject *CKGetObject(CK_ID id);
/*******************************************
Summary: Starts profiling.
Remarks:
+ The time taken by the manager between the
StartProfile / StopProfile sequence will be added
to m_ProcessingTime member of CKBaseManager and
will appear in the Profiler in the Virtools Interface.
+ The time taken by a manager on the PreProcess,PostProcess,PreRender,PostRender and PostSpriteRender
method is automatically computed so you should use these methods if there are other parts
of your manager you would like to be profiled.
See Also:StopProfile
**********************************************/
void StartProfile();
/*******************************************
Summary: Stops profiling.
Remarks:
+ The time taken by the manager between the
StartProfile / StopProfile sequence will be added
to m_ProcessingTime member of CKBaseManager and
will appear in the Profiler in the Virtools Interface.
+ The time taken by a manager on the PreProcess,PostProcess,PreRender,PostRender and PostSpriteRender
method is automatically computed so you should use these methods if there are other parts
of your manager you would like to be profiled.
See Also:StopProfile
**********************************************/
void StopProfile();
public:
CKGUID m_ManagerGuid; // Manager GUID
CKSTRING m_ManagerName; // Manager Name
CKContext* m_Context; // A pointer to the CKContext on which this manager is valid.
float m_ProcessingTime; // Time elapsed during profiling. (Reset each frame before behavioral processing starts)
VxRDTSCProfiler m_Timer;
};
#endif

View File

@ -0,0 +1,273 @@
const MAX_MANAGERFUNC_PRIORITY = 30000;
const DEFAULT_MANAGERFUNC_PRIORITY = 0;
type CKGUID = string;
type CKSTRING = string;
type CKDWORD = number;
type CK_ID = number;
type BOOL = boolean;
class CKFile {}
class CKStateChunk {}
class CKDependenciesContext {}
class CKRenderContext {}
class CKScene {}
class CKObject {}
type CKRST_EVENTS = any; // Placeholder
type CKContext = any; // Placeholder
type CKERROR = any; // Placeholder
type CKDependencies = any; // Placeholder
enum CKMANAGER_FUNCTIONS {
CKMANAGER_FUNC_OnSequenceToBeDeleted = 0x00000001,
CKMANAGER_FUNC_OnSequenceDeleted = 0x00000002,
CKMANAGER_FUNC_PreProcess = 0x00000004,
CKMANAGER_FUNC_PostProcess = 0x00000008,
CKMANAGER_FUNC_PreClearAll = 0x00000010,
CKMANAGER_FUNC_PostClearAll = 0x00000020,
CKMANAGER_FUNC_OnCKInit = 0x00000040,
CKMANAGER_FUNC_OnCKEnd = 0x00000080,
CKMANAGER_FUNC_OnCKPlay = 0x00000100,
CKMANAGER_FUNC_OnCKPause = 0x00000200,
CKMANAGER_FUNC_PreLoad = 0x00000400,
CKMANAGER_FUNC_PreSave = 0x00000800,
CKMANAGER_FUNC_PreLaunchScene = 0x00001000,
CKMANAGER_FUNC_PostLaunchScene = 0x00002000,
CKMANAGER_FUNC_OnCKReset = 0x00004000,
CKMANAGER_FUNC_PostLoad = 0x00008000,
CKMANAGER_FUNC_PostSave = 0x00010000,
CKMANAGER_FUNC_OnCKPostReset = 0x00020000,
CKMANAGER_FUNC_OnSequenceAddedToScene = 0x00040000,
CKMANAGER_FUNC_OnSequenceRemovedFromScene = 0x00080000,
CKMANAGER_FUNC_OnPreCopy = 0x00100000,
CKMANAGER_FUNC_OnPostCopy = 0x00200000,
CKMANAGER_FUNC_OnPreRender = 0x00400000,
CKMANAGER_FUNC_OnPostRender = 0x00800000,
CKMANAGER_FUNC_OnPostSpriteRender = 0x01000000,
CKMANAGER_FUNC_OnPreBackToFront = 0x02000000,
CKMANAGER_FUNC_OnPostBackToFront = 0x04000000,
CKMANAGER_FUNC_OnPreFullScreen = 0x08000000,
CKMANAGER_FUNC_OnPostFullScreen = 0x10000000,
CKMANAGER_FUNC_OnRasterizerEvent = 0x20000000,
CKMANAGER_FUNC_OnPreSpriteRender = 0x40000000,
}
enum CKMANAGER_FUNCTIONS_INDEX {
CKMANAGER_INDEX_OnSequenceToBeDeleted = 0,
CKMANAGER_INDEX_OnSequenceDeleted = 1,
CKMANAGER_INDEX_PreProcess = 2,
CKMANAGER_INDEX_PostProcess = 3,
CKMANAGER_INDEX_PreClearAll = 4,
CKMANAGER_INDEX_PostClearAll = 5,
CKMANAGER_INDEX_OnCKInit = 6,
CKMANAGER_INDEX_OnCKEnd = 7,
CKMANAGER_INDEX_OnCKPlay = 8,
CKMANAGER_INDEX_OnCKPause = 9,
CKMANAGER_INDEX_PreLoad = 10,
CKMANAGER_INDEX_PreSave = 11,
CKMANAGER_INDEX_PreLaunchScene = 12,
CKMANAGER_INDEX_PostLaunchScene = 13,
CKMANAGER_INDEX_OnCKReset = 14,
CKMANAGER_INDEX_PostLoad = 15,
CKMANAGER_INDEX_PostSave = 16,
CKMANAGER_INDEX_OnCKPostReset = 17,
CKMANAGER_INDEX_OnSequenceAddedToScene = 18,
CKMANAGER_INDEX_OnSequenceRemovedFromScene = 19,
CKMANAGER_INDEX_OnPreCopy = 20,
CKMANAGER_INDEX_OnPostCopy = 21,
CKMANAGER_INDEX_OnPreRender = 22,
CKMANAGER_INDEX_OnPostRender = 23,
CKMANAGER_INDEX_OnPostSpriteRender = 24,
CKMANAGER_INDEX_OnPreBackToFront = 25,
CKMANAGER_INDEX_OnPostBackToFront = 26,
CKMANAGER_INDEX_OnPreFullScreen = 27,
CKMANAGER_INDEX_OnPostFullScreen = 28,
CKMANAGER_INDEX_OnRasterizerEvent = 29,
CKMANAGER_INDEX_OnPreSpriteRender = 30,
}
type VxRDTSCProfiler = any; // Placeholder
class CKBaseManager {
m_ManagerGuid: CKGUID;
m_ManagerName: CKSTRING;
m_Context: CKContext;
m_ProcessingTime: number;
m_Timer: VxRDTSCProfiler;
constructor(Context: CKContext, guid: CKGUID, Name: CKSTRING) {
this.m_ManagerGuid = guid;
this.m_ManagerName = Name;
this.m_Context = Context;
this.m_ProcessingTime = 0;
// this.m_Timer = new VxRDTSCProfiler(); // Initialize if needed
}
GetGuid(): CKGUID {
return this.m_ManagerGuid;
}
GetName(): CKSTRING {
return this.m_ManagerName;
}
SaveData(SavedFile: CKFile): CKStateChunk | null {
return null;
}
LoadData(chunk: CKStateChunk, LoadedFile: CKFile): CKERROR {
return CK_OK;
}
PreClearAll(): CKERROR {
return CK_OK;
}
PostClearAll(): CKERROR {
return CK_OK;
}
PreProcess(): CKERROR {
return CK_OK;
}
PostProcess(): CKERROR {
return CK_OK;
}
SequenceAddedToScene(scn: CKScene, objids: CK_ID[], count: number): CKERROR {
return CK_OK;
}
SequenceRemovedFromScene(scn: CKScene, objids: CK_ID[], count: number): CKERROR {
return CK_OK;
}
PreLaunchScene(OldScene: CKScene, NewScene: CKScene): CKERROR {
return CK_OK;
}
PostLaunchScene(OldScene: CKScene, NewScene: CKScene): CKERROR {
return CK_OK;
}
OnCKInit(): CKERROR {
return CK_OK;
}
OnCKEnd(): CKERROR {
return CK_OK;
}
OnCKReset(): CKERROR {
return CK_OK;
}
OnCKPostReset(): CKERROR {
return CK_OK;
}
OnCKPause(): CKERROR {
return CK_OK;
}
OnCKPlay(): CKERROR {
return CK_OK;
}
SequenceToBeDeleted(objids: CK_ID[], count: number): CKERROR {
return CK_OK;
}
SequenceDeleted(objids: CK_ID[], count: number): CKERROR {
return CK_OK;
}
PreLoad(): CKERROR {
return CK_OK;
}
PostLoad(): CKERROR {
return CK_OK;
}
PreSave(): CKERROR {
return CK_OK;
}
PostSave(): CKERROR {
return CK_OK;
}
OnPreCopy(context: CKDependenciesContext): CKERROR {
return CK_OK;
}
OnPostCopy(context: CKDependenciesContext): CKERROR {
return CK_OK;
}
OnPreRender(dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPostRender(dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPreSpriteRender(dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPostSpriteRender(dev: CKRenderContext): CKERROR {
return CK_OK;
}
GetFunctionPriority(Function: CKMANAGER_FUNCTIONS): number {
return 0;
}
GetValidFunctionsMask(): CKDWORD {
return 0;
}
OnPreBackToFront(dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPostBackToFront(dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPreFullScreen(Going2Fullscreen: BOOL, dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnPostFullScreen(Going2Fullscreen: BOOL, dev: CKRenderContext): CKERROR {
return CK_OK;
}
OnRasterizerEvent(Event: CKRST_EVENTS, dev: CKRenderContext): CKERROR {
return CK_OK;
}
CKDestroyObject(obj: CKObject, Flags = 0, depoptions: CKDependencies | null = null): CKERROR {
return CK_OK;
}
CKDestroyObjectById(id: CK_ID, Flags = 0, depoptions: CKDependencies | null = null): CKERROR {
return CK_OK;
}
CKDestroyObjects(obj_ids: CK_ID[], Count: number, Flags = 0, depoptions: CKDependencies | null = null): CKERROR {
return CK_OK;
}
CKGetObject(id: CK_ID): CKObject | null {
return null;
}
StartProfile() {}
StopProfile() {}
}

View File

@ -0,0 +1,518 @@
/*************************************************************************/
/* File : CKEnums.h */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 1999, All Rights Reserved. */
/*************************************************************************/
#ifndef CKENUMS_H
#define CKENUMS_H "$Id:$"
/***************************************************
{filename:CK_OBJECT_FLAGS}
Summary: CKObject Flags
Remarks:
+ Flags specifying special settings for basic objects.
+ Some of this flags are shared with sub-classes such as CKParameterIn,CKParameterOut and CKBehaviorIO.
+ You rarely need to modify directly this flags through CKObject::SetFlags or CKObject::ModifyObjectFlags instead
you should always use the specific acces function (given between ()) which may need to perform additionnal operations.
See also: CKObject,CKObject::GetObjectFlags,CKObject::ModifyObjectFlags
*************************************************/
typedef enum CK_OBJECT_FLAGS {
CK_OBJECT_INTERFACEOBJ = 0x00000001, // Reserved for Inteface Use
CK_OBJECT_PRIVATE = 0x00000002, // The object must not be displayed in interface (Lists,Level view,etc...),nor should it be saved. (CKObject::IsPrivate()
CK_OBJECT_INTERFACEMARK = 0x00000004,
CK_OBJECT_FREEID = 0x00000008, // ID of this object can be released safely and is free to be reused by future CKobjects.
CK_OBJECT_TOBEDELETED = 0x00000010, // This object is being deleted
CK_OBJECT_NOTTOBESAVED = 0x00000020, // This object must not be saved
CK_OBJECT_VISIBLE = 0x00000040, // This object is visible (CKObject::Show)
CK_OBJECT_NAMESHARED = 0x00000080, // This object has its name from another entity
CK_OBJECT_DYNAMIC = 0x00000108, // This object may be created or deleted at run-time, it also contails CK_OBJECT_FREEID. (CKObject::IsDynamic,CKContext::CreateObject)
CK_OBJECT_HIERACHICALHIDE = 0x00000200, // This object hides all its hierarchy (CKObject::Show)
CK_OBJECT_UPTODATE = 0x00000400, // (Camera,etc..)
CK_OBJECT_TEMPMARKER = 0x00000800,
CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000,
CK_OBJECT_NOTTOBEDELETED = 0x00002000, // This object must not be deleted in a clear all
CK_OBJECT_APPDATA = 0x00004000, // This object has app data
CK_OBJECT_SINGLEACTIVITY = 0x00008000, // this object has an information of single activity (active at scene start,etc..)
CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000, // When loading this object the CKBeObject part should be skipped
CK_OBJECT_KEEPSINGLEACTIVITY = 0x00020000, // this object must keep its information of single activity (active at scene start,etc..)
CK_OBJECT_LOADREPLACINGOBJECT = 0x00040000, // Indicates the object being loaded is being replaced
CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023, // Combination of Private and Not To Be Saved
CK_OBJECT_SELECTIONSET = 0x00080000, // if group, then it is a selection set, otherwise, temporary flag used for objects belonging to a selection set. Used by Virtools's Interface
CK_OBJECT_VR_DISTRIBUTED = 0x00100000, // distributed object for VR (ie mainly used for distributed parameters for VR)
// The following flags are specific to parameters (they are stored here for object's size purposes )
CK_PARAMETEROUT_SETTINGS = 0x00400000,
CK_PARAMETEROUT_PARAMOP = 0x00800000, // This parameter is the output of a CKParameterOperation (Automatically set by Engine)
CK_PARAMETERIN_DISABLED = 0x01000000, // Parameter In or Out is disabled (CKBehavior::EnableInputParameter,CKBehavior::DisableInputParameter)
CK_PARAMETERIN_THIS = 0x02000000, // Special parameter type : its value and type are always equal to its owner (CKParameter::SetAsMyselfParameter)
CK_PARAMETERIN_SHARED = 0x04000000,
CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000, // When adding parameters to CKMessage, they can be automatically deleted when message is released (CKMessage::AddParameter)
CK_OBJECT_PARAMMASK = 0x0FC00000, // Mask for options specific to parameters
// The Following flags are specific for Behavior ios (CKBehaviorIO)
CK_BEHAVIORIO_IN = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
CK_BEHAVIORIO_OUT = 0x20000000, // This BehaviorIO is a behavior output (CKBehaviorIO::SetType)
CK_BEHAVIORIO_ACTIVE = 0x40000000, // This BehaviorIO is a currently active (CKBehaviorIO::Activate}
CK_OBJECT_IOTYPEMASK = 0x30000000,
CK_OBJECT_IOMASK = 0xF0000000,
// The Following flags are specific for Behavior ios (CKBehaviorIO)
CKBEHAVIORLINK_RESERVED = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000, // This link had been activated last frame
CK_OBJECT_BEHAVIORLINKMASK = 0x30000000,
} CK_OBJECT_FLAGS;
/************************************************************
{filename:CK_BEHAVIOR_FLAGS}
Summary: Flags settings for behaviors.
Remarks:
+ When creating a prototype, you can precise various flags
about how your behavior will act: whether it will send or receive message,
does the user may add inputs,outputs or parameters, is it active, etc.
See also: CKBehaviorPrototype::SetBehaviorFlags,Behavior Prototype Creation
**********************************************************/
typedef enum CK_BEHAVIOR_FLAGS {
CKBEHAVIOR_NONE =0x00000000, // Reserved for future use
CKBEHAVIOR_ACTIVE =0x00000001, // This behavior is active
CKBEHAVIOR_SCRIPT =0x00000002, // This behavior is a script
CKBEHAVIOR_RESERVED1 =0x00000004, // Reserved for internal use.
CKBEHAVIOR_USEFUNCTION =0x00000008, // Behavior uses a function and not a graph
CKBEHAVIOR_RESERVED2 =0x00000010, // Reserved for internal use.
CKBEHAVIOR_CUSTOMSETTINGSEDITDIALOG =0x00000020, // Behavior has a custom Dialog Box for settings edition .
CKBEHAVIOR_WAITSFORMESSAGE =0x00000040, // Behavior is waiting for a message to activate one of its outputs
CKBEHAVIOR_VARIABLEINPUTS =0x00000080, // Behavior may have its inputs changed by editing them
CKBEHAVIOR_VARIABLEOUTPUTS =0x00000100, // Behavior may have its outputs changed by editing them
CKBEHAVIOR_VARIABLEPARAMETERINPUTS =0x00000200, // Behavior may have its number of input parameters changed by editing them
CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS =0x00000400, // Behavior may have its number of output parameters changed by editing them
CKBEHAVIOR_TOPMOST =0x00004000, // No other Behavior includes this one
CKBEHAVIOR_BUILDINGBLOCK =0x00008000, // This Behavior is a building block. Automatically set by the engine when coming from a DLL.
CKBEHAVIOR_MESSAGESENDER =0x00010000, // Behavior may send messages during its execution.
CKBEHAVIOR_MESSAGERECEIVER =0x00020000, // Behavior may check messages during its execution.
CKBEHAVIOR_TARGETABLE =0x00040000, // Behavior may be owned by a different object that the one to which its execution will apply.
CKBEHAVIOR_CUSTOMEDITDIALOG =0x00080000, // This Behavior have a custom Dialog Box for parameters edition .
CKBEHAVIOR_RESERVED0 =0x00100000, // Reserved for internal use.
CKBEHAVIOR_EXECUTEDLASTFRAME =0x00200000, // This behavior has been executed during last process. (Available only in profile mode )
CKBEHAVIOR_DEACTIVATENEXTFRAME =0x00400000, // Behavior will be deactivated next frame
CKBEHAVIOR_RESETNEXTFRAME =0x00800000, // Behavior will be reseted next frame
CKBEHAVIOR_INTERNALLYCREATEDINPUTS =0x01000000, // Behavior execution may create/delete inputs
CKBEHAVIOR_INTERNALLYCREATEDOUTPUTS =0x02000000, // Behavior execution may create/delete outputs
CKBEHAVIOR_INTERNALLYCREATEDINPUTPARAMS =0x04000000, // Behavior execution may create/delete input parameters or change their type
CKBEHAVIOR_INTERNALLYCREATEDOUTPUTPARAMS=0x08000000, // Behavior execution may create/delete output parameters or change their type
CKBEHAVIOR_INTERNALLYCREATEDLOCALPARAMS =0x40000000, // Behavior execution may create/delete local parameters or change their type
CKBEHAVIOR_ACTIVATENEXTFRAME =0x10000000, // Behavior will be activated next frame
CKBEHAVIOR_LOCKED =0x20000000, // Behavior is locked for utilisation in Virtools
CKBEHAVIOR_LAUNCHEDONCE =0x80000000, // Behavior has not yet been launched...
} CK_BEHAVIOR_FLAGS;
/*************************************************
{filename:CK_BEHAVIOR_CALLBACKMASK}
Summary: Mask for the messages the callback function of a behavior should be aware of.
Remarks:
+The callback function of a behavior may ignore some messages using this mask.
+Don't forget to set the mask for the behavior callback function if you use one since it
can improve performance not to receive useless messages.
See also: CKBehaviorPrototype::SetBehaviorCallbackFct,Behavior Prototype Creation
*************************************************/
typedef enum CK_BEHAVIOR_CALLBACKMASK {
CKCB_BEHAVIORPRESAVE =0x00000001, // Callback will be called for CKM_BEHAVIORPRESAVE messages
CKCB_BEHAVIORDELETE =0x00000002, // Callback will be called for CKM_BEHAVIORDELETE messages
CKCB_BEHAVIORATTACH =0x00000004, // Callback will be called for CKM_BEHAVIORATTACH messages
CKCB_BEHAVIORDETACH =0x00000008, // Callback will be called for CKM_BEHAVIORDETACH messages
CKCB_BEHAVIORPAUSE =0x00000010, // Callback will be called for CKM_BEHAVIORPAUSE messages
CKCB_BEHAVIORRESUME =0x00000020, // Callback will be called for CKM_BEHAVIORRESUME messages
CKCB_BEHAVIORCREATE =0x00000040, // Callback will be called for CKM_BEHAVIORCREATE messages
CKCB_BEHAVIORRESET =0x00001000, // Callback will be called for CKM_BEHAVIORRESET messages
CKCB_BEHAVIORPOSTSAVE =0x00000100, // Callback will be called for CKM_BEHAVIORPOSTSAVE messages
CKCB_BEHAVIORLOAD =0x00000200, // Callback will be called for CKM_BEHAVIORLOAD messages
CKCB_BEHAVIOREDITED =0x00000400, // Callback will be called for CKM_BEHAVIOREDITED messages
CKCB_BEHAVIORSETTINGSEDITED =0x00000800, // Callback will be called for CKM_BEHAVIORSETTINGSEDITED messages
CKCB_BEHAVIORREADSTATE =0x00001000, // Callback will be called for CKM_BEHAVIORREADSTATE messages
CKCB_BEHAVIORNEWSCENE =0x00002000, // Callback will be called for CKM_BEHAVIORNEWSCENE messages
CKCB_BEHAVIORACTIVATESCRIPT =0x00004000, // Callback will be called for CKM_BEHAVIORACTIVATESCRIPT messages
CKCB_BEHAVIORDEACTIVATESCRIPT=0x00008000, // Callback will be called for CKM_BEHAVIORDEACTIVATESCRIPT messages
CKCB_BEHAVIORRESETINBREAKPOINT=0x00010000, // Callback will be called for CKM_BEHAVIORRESETINBREAKPOINT messages
CKCB_BEHAVIORBASE =0x0000000E, // Base flags :attach /detach /delete
CKCB_BEHAVIORSAVELOAD =0x00000301, // Base flags for load and save
CKCB_BEHAVIORPPR =0x00000130, // Base flags for play/pause/reset
CKCB_BEHAVIOREDITIONS =0x00000C00, // Base flags for editions of settings or parameters
CKCB_BEHAVIORALL =0xFFFFFFFF, // All flags
} CK_BEHAVIOR_CALLBACKMASK;
/*************************************************
{filename:CK_BEHAVIOR_RETURN}
Summary: Return value for the behavior execution function.
Remarks:
+ Return value of a behavior execution function is used to activate it
the next frame and handle errors.
+ A return value with _RETRY (CKBR_ACTIVATENEXTFRAME bit set) forces the behavior to be reactivated next frame.
See also: CKBehaviorPrototype::SetFunction
*************************************************/
typedef enum CK_BEHAVIOR_RETURN
{
CKBR_OK = 0, // Everything's ok. Behavior is deactivated unless one of its inputs is active.
CKBR_ACTIVATENEXTFRAME = 1, // The behavior will be reactivated next frame
CKBR_ATTACHFAILED = 2, // The attach failed
CKBR_DETACHFAILED = 4, // The attach failed
CKBR_LOCKED = 6, // obsolete..
CKBR_INFINITELOOP = 8, // The behavior has reached the infinite loop limit...
CKBR_BREAK = 10, // Break the processing here => Keep on processing windows messages but keep on calling the behavior until
// it returns a different value (Used by script debugger )
CKBR_GENERICERROR = 0xA000, // Something went wrong
CKBR_BEHAVIORERROR = 0xA002, // The behavior gave to the code was wrong
CKBR_OWNERERROR = 0xA004, // The owner isn't what it should be
CKBR_PARAMETERERROR = 0xA008, // Some of the parameters are wrong
CKBR_GENERICERROR_RETRY = 0xA001,
CKBR_BEHAVIORERROR_RETRY = 0xA003,
CKBR_OWNERERROR_RETRY = 0xA005,
CKBR_PARAMETERERROR_RETRY = 0xA009,
} CK_BEHAVIOR_RETURN;
/*************************************************
{filename:CK_BEHAVIOR_TYPE}
Summary: Behavior Type.
Remarks:
+ Behaviors may be scripts, simpliest behaviors (a function) or elaborated graphs of sub-behaviors.
See also: CKBehavior::GetType
*************************************************/
typedef enum CK_BEHAVIOR_TYPE {
CKBEHAVIORTYPE_BASE =0x00000000, // This Behavior is a most simple type of behavior ( a function )
CKBEHAVIORTYPE_SCRIPT =0x00000001, // This Behavior is a script
CKBEHAVIORTYPE_BEHAVIOR =0x00000004, // This Behavior is a simple one ( a graph )
} CK_BEHAVIOR_TYPE;
/*************************************************
{filename:CK_PARAMETERTYPE_FLAGS}
Summary: Flags settings for new parameter types
Remarks:
+These flags specify special settings for a parameter type.
+Parameter may have a fixed or variable buffer size, some may be hidden
so that they are not displayed in the interface.
See also: CKParameterTypeDesc
*************************************************/
typedef enum CK_PARAMETERTYPE_FLAGS {
CKPARAMETERTYPE_VARIABLESIZE = 0x00000001, // Size of the buffer stored by the parameter may change
CKPARAMETERTYPE_RESERVED = 0x00000002, // Reserved
CKPARAMETERTYPE_HIDDEN = 0x00000004, // This parameter type should not be shown in the interface
CKPARAMETERTYPE_FLAGS = 0x00000008, // This parameter type is a flag (See CKParameterManager::RegisterNewFlags)
CKPARAMETERTYPE_STRUCT = 0x00000010, // This parameter type is a structure of parameters (See CKParameterManager::RegisterNewStructure)
CKPARAMETERTYPE_ENUMS = 0x00000020, // This parameter type is an enumeration (See CKParameterManager::RegisterNewEnum)
CKPARAMETERTYPE_USER = 0x00000040, // This parameter type is a user-defined one created in the interface
CKPARAMETERTYPE_NOENDIANCONV = 0x00000080, // Do not try to convert this parameter buffer On Big-Endian processors (strings, void buffer have this flags)
CKPARAMETERTYPE_TOSAVE = 0x00000100, // Temporary flag set in CKFile::EndSave(). This parameter type is to be saved in the SaveData callback of managers. Used in Parameter Manager (used user's flags & enums)
} CK_PARAMETERTYPE_FLAGS;
/*************************************************
{filename:CK_ATTRIBUT_FLAGS}
Summary: Attribute Flags
Remarks:
+ When created a new attribute type with CKAttributeManager::RegisterNewAttributeType , it can
be given special properties that will control its behavior in the Dev interface and other
special features such as the ability for an attribute to be copied or saved along with the object
it belongs to.
See also: CKAttributeManager::RegisterNewAttributeType,CKAttributeManager::GetAttributeFlags
*************************************************/
typedef enum CK_ATTRIBUT_FLAGS {
CK_ATTRIBUT_CAN_MODIFY = 0x00000001, // This Attribute type may be renamed
CK_ATTRIBUT_CAN_DELETE = 0x00000002, // This Attribute type may be deleted
CK_ATTRIBUT_HIDDEN = 0x00000004, // This Attribute type will not appear in the Virtools Interface
CK_ATTRIBUT_DONOTSAVE = 0x00000008, // This Attribute type will not be saved
CK_ATTRIBUT_USER = 0x00000010, // This Attribute type was created by a user (in the Dev interface for example)
CK_ATTRIBUT_SYSTEM = 0x00000020, // This Attribute type was created by the system (Behavior Dll,Manager,etc...)
CK_ATTRIBUT_DONOTCOPY = 0x00000040, // This Attribute type will not be copied when the object that holds it is copied
CK_ATTRIBUT_TOSAVE = 0x00000080, // Temporary flag set in CKFile::EndSave(). This parameter type is to be saved in the SaveData callback of managers. Used in Attribute Manager (used attributes)
} CK_ATTRIBUT_FLAGS;
//----------------------------------------------------------////
// Behavior Prototype Flags ////
//----------------------------------------------------------////
typedef enum CK_BEHAVIORPROTOTYPE_FLAGS {
CK_BEHAVIORPROTOTYPE_NORMAL =0x00000001,
CK_BEHAVIORPROTOTYPE_HIDDEN =0x00000002,
CK_BEHAVIORPROTOTYPE_OBSOLETE =0x00000004,
} CK_BEHAVIORPROTOTYPE_FLAGS;
/*************************************************
{filename:CK_LOADMODE}
Summary: Specify the way an object just loaded should be handled when it already exists in the level.
{secret}
See also:
*************************************************/
typedef enum CK_LOADMODE
{
CKLOAD_INVALID=-1,// Use the existing object instead of loading
CKLOAD_OK=0, // Ignore ( Name unicity is broken )
CKLOAD_REPLACE=1, // Replace the existing object (Not yet implemented)
CKLOAD_RENAME=2, // Rename the loaded object
CKLOAD_USECURRENT=3,// Use the existing object instead of loading
} CK_LOADMODE,CK_CREATIONMODE;
/*************************************************
{filename:CK_OBJECTCREATION_OPTIONS}
Summary: Specify the way an object is created through CKCreateObject.
Remarks:
+ These flag controls the way an object is created, the most important of these flags
being CK_OBJECTCREATION_DYNAMIC which, if set in CKCreateObject, make the newly created object
dynamic.
See also: CKContext::CreateObject,Dynamic Objects
*************************************************/
enum CK_OBJECTCREATION_OPTIONS
{
CK_OBJECTCREATION_NONAMECHECK = 0, // Do not test for name unicity (may be overriden in special case)
CK_OBJECTCREATION_REPLACE = 1, // Replace the current object by the object being loaded
CK_OBJECTCREATION_RENAME = 2, // Rename the created object to ensure its uniqueness
CK_OBJECTCREATION_USECURRENT = 3, // Do not create a new object, use the one with the same name instead
CK_OBJECTCREATION_ASK = 4, // If a duplicate name if found, opens a dialog box to ask the useror use automatic load mode if any.
CK_OBJECTCREATION_FLAGSMASK = 0x0000000F, // Mask for previous values
CK_OBJECTCREATION_DYNAMIC = 0x00000010, // The object must be created dynamic
CK_OBJECTCREATION_ACTIVATE = 0x00000020, // The object will be copied/created active
CK_OBJECTCREATION_NONAMECOPY = 0x00000040 // The object will take control of the string given to it directly, without copying it
};
#define CK_OBJECTCREATION_SameDynamic (IsDynamic() ? CK_OBJECTCREATION_DYNAMIC : CK_OBJECTCREATION_NONAMECHECK)
#define CK_OBJECTCREATION_Dynamic(x) (x ? CK_OBJECTCREATION_DYNAMIC : CK_OBJECTCREATION_NONAMECHECK)
/*************************************************
{filename:CK_DEPENDENCIES_OPMODE}
Summary: Specify the mode of operation of a CKDependenciesContext.
Remarks:
A CKDependenciesContext class is always used when it come to work
with object dependencies (A mesh if a dependencies of a CK3dEntity for example)
See also: CKCreateObject
*************************************************/
typedef enum CK_DEPENDENCIES_OPMODE {
CK_DEPENDENCIES_COPY = 1, // Copying objects
CK_DEPENDENCIES_DELETE = 2, // Deleting objects
CK_DEPENDENCIES_REPLACE = 3,
CK_DEPENDENCIES_SAVE = 4, // Saving objects
CK_DEPENDENCIES_BUILD = 5, // Building a list of dependencies
CK_DEPENDENCIES_OPERATIONMODE = 0xF
} CK_DEPENDENCIES_OPMODE;
/*************************************************
{filename:CK_FILE_WRITEMODE}
Summary: Specify the way files are saved to disk (compression)
Remarks :
+ File write mode controls the format of a Virtools file when saved. More specifically it
controls whether compression is enabled and also if the Virtools Interface specific data
should be stored in the file (if CKFILE_FORVIEWER flag is set , no interface data is saved)
See also: CKContext::SetFileWriteMode,CKContext::GetFileWriteMode,CKContext::SetCompressionLevel,CKContext::SetGlobalImagesSaveOptions,CKContext::SetGlobalSoundsSaveOptions
*************************************************/
typedef enum CK_FILE_WRITEMODE
{
CKFILE_UNCOMPRESSED =0, // Save data uncompressed
CKFILE_CHUNKCOMPRESSED_OLD =1, // Obsolete
CKFILE_EXTERNALTEXTURES_OLD=2, // Obsolete : use CKContext::SetGlobalImagesSaveOptions instead.
CKFILE_FORVIEWER =4, // Don't save Interface Data within the file, the level won't be editable anymore in the interface
CKFILE_WHOLECOMPRESSED =8, // Compress the whole file
} CK_FILE_WRITEMODE;
/*************************************************
{filename:CK_CONFIG_FLAGS}
Summary: Flags specifying start options for Virtools
Remarks:
Flags specifying start options for Virtools
See also: CKCreateContext
*************************************************/
typedef enum CK_CONFIG_FLAGS {
CK_CONFIG_DISABLEDSOUND= 1, // Prevent CK from initializing Sound Engines
CK_CONFIG_DISABLEDINPUT= 2, // Prevent CK from initializing Input Engines
CK_CONFIG_DOWARN= 4 // Set this flag for message box warning (sound init failed, etc.)
} CK_CONFIG_FLAGS;
/*************************************************
{filename:CK_DESTROY_FLAGS}
Summary: Objects destruction Flags
Remarks: Flags specifying how objects should be deleted.
See also: CKContext::DestroyObjects,CKContext::DestroyObject
*************************************************/
typedef enum CK_DESTROY_FLAGS {
CK_DESTROY_FREEID = 0x00000001, // Release the CK_ID of the object so that it can be re-used bu new objects.
CK_DESTROY_NONOTIFY = 0x00000002, // Managers and other objects won't be notified of this deletion
CK_DESTROY_TEMPOBJECT = 0x00000003, // Combination for temporary objects : Do not notify and release CK_ID
} CK_DESTROY_FLAGS;
//----------------------------------------------------------////
// Data Array Flags and Enums ////
//----------------------------------------------------------////
/************************************************
{filename:CK_BINARYOPERATOR}
Summary: Available operations between colums of a DataArray
See Also: CKDataArray::ColumnTransform, CKDataArray::ColumnsOperate
************************************************/
typedef enum CK_BINARYOPERATOR{
CKADD = 1, // Addition
CKSUB = 2, // Substraction
CKMUL = 3, // Multiplication
CKDIV = 4 // Division
} CK_BINARYOPERATOR;
/************************************************
{filename:CK_COMPOPERATOR}
Summary: Available comparisons between colums of a DataArray
Remarks:
See Also: CKDataArray::CreateGroup, CKDataArray::FindLine
************************************************/
typedef enum CK_COMPOPERATOR{
CKEQUAL = 1,
CKNOTEQUAL = 2,
CKLESSER = 3,
CKLESSEREQUAL = 4,
CKGREATER = 5,
CKGREATEREQUAL = 6
} CK_COMPOPERATOR;
typedef enum CK_SETOPERATOR{
CKUNION = 1, // Addition
CKINTERSECTION = 2, // Intersection
CKSUBTRACTION = 3, // Subtraction
} CK_SETOPERATOR;
/************************************************
{filename:CK_ARRAYTYPE}
Summary: Enum defining the format of a Data Array element.
Remarks:
+ In a data array each column can contain data
of the given type.
See Also: CKDataArray::InsertColumn, CKDataArray::GetColumnType
************************************************/
typedef enum CK_ARRAYTYPE{
CKARRAYTYPE_INT = 1, // an integer
CKARRAYTYPE_FLOAT = 2, // a float
CKARRAYTYPE_STRING = 3, // a pointer to a string
CKARRAYTYPE_OBJECT = 4, // a CKObject ID (CK_ID)
CKARRAYTYPE_PARAMETER = 5 // a CKParameter ID
} CK_ARRAYTYPE;
/*************************************************
{filename:CK_LOAD_FLAGS}
Summary: Load Options.
Remarks:
+ This options apply when loading a Virtools file
or a importing a 3D Model file.
+ They defines whether object geometry,only animations
or only behaviors should be loaded.
+ One can specify (using the CK_LOAD_AS_DYNAMIC_OBJECT) if
created CKObjects should be created as dynamic (See also Dynamic Objects)
See also : CKContext::Load,CKContext::CKSave
*************************************************/
typedef enum CK_LOAD_FLAGS {
CK_LOAD_ANIMATION =1<<0, // Load animations
CK_LOAD_GEOMETRY =1<<1, // Load geometry.
CK_LOAD_DEFAULT =CK_LOAD_GEOMETRY|CK_LOAD_ANIMATION, // Load animations & geometry
CK_LOAD_ASCHARACTER =1<<2, // Load all the objects and create a character that contains them all .
CK_LOAD_DODIALOG =1<<3, // Check object name unicity and warns the user with a dialog box when duplicate names are found.
CK_LOAD_AS_DYNAMIC_OBJECT =1<<4, // Objects loaded from this file may be deleted at run-time or are temporary
CK_LOAD_AUTOMATICMODE =1<<5, // Check object name unicity and automatically rename or replace according to the options specified in CKContext::SetAutomaticLoadMode
CK_LOAD_CHECKDUPLICATES =1<<6, // Check object name unicity (The list of duplicates is stored in the CKFile class after a OpenFile call
CK_LOAD_CHECKDEPENDENCIES =1<<7, // Check if every plugins needed are availables
CK_LOAD_ONLYBEHAVIORS =1<<8, //
CK_LOAD_REPLACEALL_WITHSCRIPT =1<<9, // Replace all duplicates names, scripts included (old scripts are deleted)
} CK_LOAD_FLAGS;
/*************************************************
{filename:CK_PLUGIN_TYPE}
Summary: Type identifier for a Virtools plugin.
Remarks:
+Each plugin must be given a type.
+This enumeration is used to identify a specific catagory
of plugin when using the CKPluginManager.
See also: CKPluginManager,Creating New Plugins
*************************************************/
typedef enum CK_PLUGIN_TYPE {
CKPLUGIN_BITMAP_READER = 0, // The plugin is bitmap (textures,sprites) loader
CKPLUGIN_SOUND_READER = 1, // Sound Reader Plugin
CKPLUGIN_MODEL_READER = 2, // 3D Model Reader
CKPLUGIN_MANAGER_DLL = 3, // The plugin implements a Manager
CKPLUGIN_BEHAVIOR_DLL = 4, // The plugin implements one or more behaviors
CKPLUGIN_RENDERENGINE_DLL = 5, // Render Engine plugin
CKPLUGIN_MOVIE_READER = 6, // Movie (AVI,Mpeg) reader
CKPLUGIN_EXTENSION_DLL = 7, // Generic extension (definition of new parameter types or operations for ex.)
} CK_PLUGIN_TYPE;
typedef enum CK_PARAMETER_FLAGS {
CKPARAMETER_LOCAL =0, // The parameter is local to a CKBehavior
CKPARAMETER_IN =1, // The parameter is an input of a CKBehavior
CKPARAMETER_OUT =2, // The parameter is an output of a CKBehavior or a parameter of a CKBeObject
CKPARAMETER_SETTING =3, // The parameter is used as a setting parameter by a CKBehavior.
} CK_PARAMETER_FLAGS;
typedef enum CK_PROFILE_CATEGORY {
CK_PROFILE_RENDERTIME = 3,
CK_PROFILE_IKTIME = 7,
CK_PROFILE_ANIMATIONTIME = 6,
} CK_PROFILE_CATEGORY;
/**********************************************************
{filename:CK_BONES_REFERENTIAL}
Summary : Type of bone matrices send to the skinning shader
***************************************************************/
typedef enum CK_BONES_REFERENTIAL {
CK_BONE_LOCAL = 0x00000000, // Matrices transformed from bones referential to skin holder referential
CK_BONE_WORLD , // Matrices transformed from bones referential to world referential
CK_BONE_WORLDVIEW , // Matrices transformed from bones referential to camera referential
}CK_BONES_REFERENTIAL;
#endif

View File

@ -0,0 +1,273 @@
enum CK_OBJECT_FLAGS {
CK_OBJECT_INTERFACEOBJ = 0x00000001,
CK_OBJECT_PRIVATE = 0x00000002,
CK_OBJECT_INTERFACEMARK = 0x00000004,
CK_OBJECT_FREEID = 0x00000008,
CK_OBJECT_TOBEDELETED = 0x00000010,
CK_OBJECT_NOTTOBESAVED = 0x00000020,
CK_OBJECT_VISIBLE = 0x00000040,
CK_OBJECT_NAMESHARED = 0x00000080,
CK_OBJECT_DYNAMIC = 0x00000108,
CK_OBJECT_HIERACHICALHIDE = 0x00000200,
CK_OBJECT_UPTODATE = 0x00000400,
CK_OBJECT_TEMPMARKER = 0x00000800,
CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000,
CK_OBJECT_NOTTOBEDELETED = 0x00002000,
CK_OBJECT_APPDATA = 0x00004000,
CK_OBJECT_SINGLEACTIVITY = 0x00008000,
CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000,
CK_OBJECT_KEEPSINGLEACTIVITY = 0x00020000,
CK_OBJECT_LOADREPLACINGOBJECT = 0x00040000,
CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023,
CK_OBJECT_SELECTIONSET = 0x00080000,
CK_OBJECT_VR_DISTRIBUTED = 0x00100000,
CK_PARAMETEROUT_SETTINGS = 0x00400000,
CK_PARAMETEROUT_PARAMOP = 0x00800000,
CK_PARAMETERIN_DISABLED = 0x01000000,
CK_PARAMETERIN_THIS = 0x02000000,
CK_PARAMETERIN_SHARED = 0x04000000,
CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000,
CK_OBJECT_PARAMMASK = 0x0FC00000,
CK_BEHAVIORIO_IN = 0x10000000,
CK_BEHAVIORIO_OUT = 0x20000000,
CK_BEHAVIORIO_ACTIVE = 0x40000000,
CK_OBJECT_IOTYPEMASK = 0x30000000,
CK_OBJECT_IOMASK = 0xF0000000,
CKBEHAVIORLINK_RESERVED = 0x10000000,
CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000,
CK_OBJECT_BEHAVIORLINKMASK = 0x30000000,
}
enum CK_BEHAVIOR_FLAGS {
CKBEHAVIOR_NONE = 0x00000000,
CKBEHAVIOR_ACTIVE = 0x00000001,
CKBEHAVIOR_SCRIPT = 0x00000002,
CKBEHAVIOR_RESERVED1 = 0x00000004,
CKBEHAVIOR_USEFUNCTION = 0x00000008,
CKBEHAVIOR_RESERVED2 = 0x00000010,
CKBEHAVIOR_CUSTOMSETTINGSEDITDIALOG = 0x00000020,
CKBEHAVIOR_WAITSFORMESSAGE = 0x00000040,
CKBEHAVIOR_VARIABLEINPUTS = 0x00000080,
CKBEHAVIOR_VARIABLEOUTPUTS = 0x00000100,
CKBEHAVIOR_VARIABLEPARAMETERINPUTS = 0x00000200,
CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS = 0x00000400,
CKBEHAVIOR_TOPMOST = 0x00004000,
CKBEHAVIOR_BUILDINGBLOCK = 0x00008000,
CKBEHAVIOR_MESSAGESENDER = 0x00010000,
CKBEHAVIOR_MESSAGERECEIVER = 0x00020000,
CKBEHAVIOR_TARGETABLE = 0x00040000,
CKBEHAVIOR_CUSTOMEDITDIALOG = 0x00080000,
CKBEHAVIOR_RESERVED0 = 0x00100000,
CKBEHAVIOR_EXECUTEDLASTFRAME = 0x00200000,
CKBEHAVIOR_DEACTIVATENEXTFRAME = 0x00400000,
CKBEHAVIOR_RESETNEXTFRAME = 0x00800000,
CKBEHAVIOR_INTERNALLYCREATEDINPUTS = 0x01000000,
CKBEHAVIOR_INTERNALLYCREATEDOUTPUTS = 0x02000000,
CKBEHAVIOR_INTERNALLYCREATEDINPUTPARAMS = 0x04000000,
CKBEHAVIOR_INTERNALLYCREATEDOUTPUTPARAMS = 0x08000000,
CKBEHAVIOR_INTERNALLYCREATEDLOCALPARAMS = 0x40000000,
CKBEHAVIOR_ACTIVATENEXTFRAME = 0x10000000,
CKBEHAVIOR_LOCKED = 0x20000000,
CKBEHAVIOR_LAUNCHEDONCE = 0x80000000,
}
enum CK_BEHAVIOR_CALLBACKMASK {
CKCB_BEHAVIORPRESAVE = 0x00000001,
CKCB_BEHAVIORDELETE = 0x00000002,
CKCB_BEHAVIORATTACH = 0x00000004,
CKCB_BEHAVIORDETACH = 0x00000008,
CKCB_BEHAVIORPAUSE = 0x00000010,
CKCB_BEHAVIORRESUME = 0x00000020,
CKCB_BEHAVIORCREATE = 0x00000040,
CKCB_BEHAVIORRESET = 0x00001000,
CKCB_BEHAVIORPOSTSAVE = 0x00000100,
CKCB_BEHAVIORLOAD = 0x00000200,
CKCB_BEHAVIOREDITED = 0x00000400,
CKCB_BEHAVIORSETTINGSEDITED = 0x00000800,
CKCB_BEHAVIORREADSTATE = 0x00001000,
CKCB_BEHAVIORNEWSCENE = 0x00002000,
CKCB_BEHAVIORACTIVATESCRIPT = 0x00004000,
CKCB_BEHAVIORDEACTIVATESCRIPT = 0x00008000,
CKCB_BEHAVIORRESETINBREAKPOINT = 0x00010000,
CKCB_BEHAVIORBASE = 0x0000000E,
CKCB_BEHAVIORSAVELOAD = 0x00000301,
CKCB_BEHAVIORPPR = 0x00000130,
CKCB_BEHAVIOREDITIONS = 0x00000C00,
CKCB_BEHAVIORALL = 0xFFFFFFFF,
}
enum CK_BEHAVIOR_RETURN {
CKBR_OK = 0,
CKBR_ACTIVATENEXTFRAME = 1,
CKBR_ATTACHFAILED = 2,
CKBR_DETACHFAILED = 4,
CKBR_LOCKED = 6,
CKBR_INFINITELOOP = 8,
CKBR_BREAK = 10,
CKBR_GENERICERROR = 0xA000,
CKBR_BEHAVIORERROR = 0xA002,
CKBR_OWNERERROR = 0xA004,
CKBR_PARAMETERERROR = 0xA008,
CKBR_GENERICERROR_RETRY = 0xA001,
CKBR_BEHAVIORERROR_RETRY = 0xA003,
CKBR_OWNERERROR_RETRY = 0xA005,
CKBR_PARAMETERERROR_RETRY = 0xA009,
}
enum CK_BEHAVIOR_TYPE {
CKBEHAVIORTYPE_BASE = 0x00000000,
CKBEHAVIORTYPE_SCRIPT = 0x00000001,
CKBEHAVIORTYPE_BEHAVIOR = 0x00000004,
}
enum CK_PARAMETERTYPE_FLAGS {
CKPARAMETERTYPE_VARIABLESIZE = 0x00000001,
CKPARAMETERTYPE_RESERVED = 0x00000002,
CKPARAMETERTYPE_HIDDEN = 0x00000004,
CKPARAMETERTYPE_FLAGS = 0x00000008,
CKPARAMETERTYPE_STRUCT = 0x00000010,
CKPARAMETERTYPE_ENUMS = 0x00000020,
CKPARAMETERTYPE_USER = 0x00000040,
CKPARAMETERTYPE_NOENDIANCONV = 0x00000080,
CKPARAMETERTYPE_TOSAVE = 0x00000100,
}
enum CK_ATTRIBUT_FLAGS {
CK_ATTRIBUT_CAN_MODIFY = 0x00000001,
CK_ATTRIBUT_CAN_DELETE = 0x00000002,
CK_ATTRIBUT_HIDDEN = 0x00000004,
CK_ATTRIBUT_DONOTSAVE = 0x00000008,
CK_ATTRIBUT_USER = 0x00000010,
CK_ATTRIBUT_SYSTEM = 0x00000020,
CK_ATTRIBUT_DONOTCOPY = 0x00000040,
CK_ATTRIBUT_TOSAVE = 0x00000080,
}
enum CK_BEHAVIORPROTOTYPE_FLAGS {
CK_BEHAVIORPROTOTYPE_NORMAL = 0x00000001,
CK_BEHAVIORPROTOTYPE_HIDDEN = 0x00000002,
CK_BEHAVIORPROTOTYPE_OBSOLETE = 0x00000004,
}
enum CK_LOADMODE {
CKLOAD_INVALID = -1,
CKLOAD_OK = 0,
CKLOAD_REPLACE = 1,
CKLOAD_RENAME = 2,
CKLOAD_USECURRENT = 3,
}
enum CK_OBJECTCREATION_OPTIONS {
CK_OBJECTCREATION_NONAMECHECK = 0,
CK_OBJECTCREATION_REPLACE = 1,
CK_OBJECTCREATION_RENAME = 2,
CK_OBJECTCREATION_USECURRENT = 3,
CK_OBJECTCREATION_ASK = 4,
CK_OBJECTCREATION_FLAGSMASK = 0x0000000F,
CK_OBJECTCREATION_DYNAMIC = 0x00000010,
CK_OBJECTCREATION_ACTIVATE = 0x00000020,
CK_OBJECTCREATION_NONAMECOPY = 0x00000040,
}
enum CK_DEPENDENCIES_OPMODE {
CK_DEPENDENCIES_COPY = 1,
CK_DEPENDENCIES_DELETE = 2,
CK_DEPENDENCIES_REPLACE = 3,
CK_DEPENDENCIES_SAVE = 4,
CK_DEPENDENCIES_BUILD = 5,
CK_DEPENDENCIES_OPERATIONMODE = 0xF,
}
enum CK_FILE_WRITEMODE {
CKFILE_UNCOMPRESSED = 0,
CKFILE_CHUNKCOMPRESSED_OLD = 1,
CKFILE_EXTERNALTEXTURES_OLD = 2,
CKFILE_FORVIEWER = 4,
CKFILE_WHOLECOMPRESSED = 8,
}
enum CK_CONFIG_FLAGS {
CK_CONFIG_DISABLEDSOUND = 1,
CK_CONFIG_DISABLEDINPUT = 2,
CK_CONFIG_DOWARN = 4,
}
enum CK_DESTROY_FLAGS {
CK_DESTROY_FREEID = 0x00000001,
CK_DESTROY_NONOTIFY = 0x00000002,
CK_DESTROY_TEMPOBJECT = 0x00000003,
}
enum CK_BINARYOPERATOR {
CKADD = 1,
CKSUB = 2,
CKMUL = 3,
CKDIV = 4,
}
enum CK_COMPOPERATOR {
CKEQUAL = 1,
CKNOTEQUAL = 2,
CKLESSER = 3,
CKLESSEREQUAL = 4,
CKGREATER = 5,
CKGREATEREQUAL = 6,
}
enum CK_SETOPERATOR {
CKUNION = 1,
CKINTERSECTION = 2,
CKSUBTRACTION = 3,
}
enum CK_ARRAYTYPE {
CKARRAYTYPE_INT = 1,
CKARRAYTYPE_FLOAT = 2,
CKARRAYTYPE_STRING = 3,
CKARRAYTYPE_OBJECT = 4,
CKARRAYTYPE_PARAMETER = 5,
}
enum CK_LOAD_FLAGS {
CK_LOAD_ANIMATION = 1 << 0,
CK_LOAD_GEOMETRY = 1 << 1,
CK_LOAD_DEFAULT = CK_LOAD_GEOMETRY | CK_LOAD_ANIMATION,
CK_LOAD_ASCHARACTER = 1 << 2,
CK_LOAD_DODIALOG = 1 << 3,
CK_LOAD_AS_DYNAMIC_OBJECT = 1 << 4,
CK_LOAD_AUTOMATICMODE = 1 << 5,
CK_LOAD_CHECKDUPLICATES = 1 << 6,
CK_LOAD_CHECKDEPENDENCIES = 1 << 7,
CK_LOAD_ONLYBEHAVIORS = 1 << 8,
CK_LOAD_REPLACEALL_WITHSCRIPT = 1 << 9,
}
enum CK_PLUGIN_TYPE {
CKPLUGIN_BITMAP_READER = 0,
CKPLUGIN_SOUND_READER = 1,
CKPLUGIN_MODEL_READER = 2,
CKPLUGIN_MANAGER_DLL = 3,
CKPLUGIN_BEHAVIOR_DLL = 4,
CKPLUGIN_RENDERENGINE_DLL = 5,
CKPLUGIN_MOVIE_READER = 6,
CKPLUGIN_EXTENSION_DLL = 7,
}
enum CK_PARAMETER_FLAGS {
CKPARAMETER_LOCAL = 0,
CKPARAMETER_IN = 1,
CKPARAMETER_OUT = 2,
CKPARAMETER_SETTING = 3,
}
enum CK_PROFILE_CATEGORY {
CK_PROFILE_RENDERTIME = 3,
CK_PROFILE_IKTIME = 7,
CK_PROFILE_ANIMATIONTIME = 6,
}
enum CK_BONES_REFERENTIAL {
CK_BONE_LOCAL = 0x00000000,
CK_BONE_WORLD,
CK_BONE_WORLDVIEW,
}

View File

@ -0,0 +1,160 @@
/*************************************************************************/
/* File : CKParameter.h */
/* Author : Nicolas Galinotti */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKParameter_H
#define CKParameter_H
#include "CKObject.h"
/**************************************************************************
{filename:CKParameter}
Name: CKParameter
Summary: Base class for output and local parameter
Remarks:
+ The type of the parameter defines the type of the data provided. These types are maintained by
the parameter manager. It defines the size of the buffer to use, and also decides what can be plugged
onto the output parameter. To have the list and definition of predefined parameter types see CKParameterManager.
+ The class id of CKParameter is CKCID_PARAMETER.
See also: CKBehavior, CKParameterIn, CKParameterOperation
**********************************************************************************/
class CKParameter : public CKObject {
friend class CKParameterIn;
friend class CKParameterManager;
public :
//--------------------------------------------
// Value
CKObject* GetValueObject(CKBOOL update = TRUE);
virtual CKERROR GetValue(void *buf, CKBOOL update = TRUE);
virtual CKERROR SetValue(const void *buf,int size = 0);
virtual CKERROR CopyValue(CKParameter *param,CKBOOL UpdateParam=TRUE);
CKBOOL IsCompatibleWith(CKParameter *param);
//--------------------------------------------
// Data pointer
int GetDataSize();
virtual void * GetReadDataPtr(CKBOOL update = TRUE);
virtual void * GetWriteDataPtr();
//--------------------------------------------
// Convertion from / to string
virtual CKERROR SetStringValue(CKSTRING Value);
virtual int GetStringValue(CKSTRING Value,CKBOOL update = TRUE);
//--------------------------------------------
// Type
CKParameterType GetType();
void SetType(CKParameterType type);
CKGUID GetGUID();
void SetGUID(CKGUID guid);
CK_CLASSID GetParameterClassID();
//--------------------------------------------
// Owner
virtual void SetOwner(CKObject *o);
CKObject * GetOwner();
// Virtual added for Fixed Size parameter support
virtual void CheckClass(CKParameterTypeDesc* iType);
//--------------------------------------------
// Disabled parameters in behaviors
//-------------------------------------------------------------------
#ifdef DOCJETDUMMY // Docjet secret macro
#else
void Enable(CKBOOL act=TRUE);
CKBOOL IsEnabled();
//--------------------------------------------
// Virtual functions
CKParameter(CKContext *Context,CKSTRING name = NULL);
virtual ~CKParameter();
virtual CK_CLASSID GetClassID();
virtual void PreSave(CKFile *file,CKDWORD flags);
virtual CKStateChunk *Save(CKFile *file,CKDWORD flags);
virtual CKERROR Load(CKStateChunk *chunk,CKFile* file);
virtual void CheckPostDeletion();
virtual int GetMemoryOccupation();
virtual int IsObjectUsed(CKObject* o,CK_CLASSID cid);
//--------------------------------------------
// Dependencies Functions
virtual CKERROR PrepareDependencies(CKDependenciesContext& context, CKBOOL iCaller = TRUE);
virtual CKERROR RemapDependencies(CKDependenciesContext& context);
virtual CKERROR Copy(CKObject& o,CKDependenciesContext& context);
//--------------------------------------------
// Class Registering
static CKSTRING GetClassName();
static int GetDependenciesCount(int mode);
static CKSTRING GetDependencies(int i,int mode);
static void Register();
static CKParameter* CreateInstance(CKContext *Context);
static void ReleaseInstance(CKContext* iContext,CKParameter*);
static CK_CLASSID m_ClassID;
// Dynamic Cast method (returns NULL if the object can't be casted)
static CKParameter* Cast(CKObject* iO)
{
return CKIsChildClassOf(iO,CKCID_PARAMETER)?(CKParameter*)iO:NULL;
}
CKERROR CreateDefaultValue();
void MessageDeleteAfterUse(CKBOOL act);
CKParameterTypeDesc* GetParameterType() { return m_ParamType; }
CKBOOL IsCandidateForFixedSize(CKParameterTypeDesc* iType);
protected:
CKObject* m_Owner;
CKParameterTypeDesc* m_ParamType;
#ifdef PSP
unsigned short m_DataSize;
unsigned short m_AllocatedSize;
#else
union{
int m_DataSize;
int m_AllocatedSize;
};
#endif
union {
CKBYTE* m_Buffer;
CKDWORD m_Value;
};
friend void CK_ParameterCopier_Memcpy(CKParameter* Dst,CKParameter* Src);
friend void CK_ParameterCopier_SaveLoad(CKParameter* Dst,CKParameter* Src);
friend void CK_ParameterCopier_SetValue(CKParameter* Dst,CKParameter* Src);
friend void CK_ParameterCopier_Dword(CKParameter* Dst,CKParameter* Src);
friend void CK_ParameterCopier_BufferCompatibleWithDWORD(CKParameter* Dst,CKParameter* Src);
friend void CKObjectArrayRemapfunc (CKParameter *param,CKDependenciesContext&);
friend void CKObjectRemapFunc (CKParameter *param,CKDependenciesContext&);
friend void CKStructRemapFunc (CKParameter *param,CKDependenciesContext&);
#endif // docjet secret macro
};
#endif

View File

@ -0,0 +1,202 @@
class CKParameter extends CKObject {
private m_Owner: CKObject | null;
private m_ParamType: CKParameterTypeDesc | null;
private m_DataSize: number;
private m_AllocatedSize: number;
private m_Buffer: Uint8Array | null;
constructor(context: CKContext, name: string | null = null) {
super(context, name);
this.m_Owner = null;
this.m_ParamType = null;
this.m_DataSize = 0;
this.m_AllocatedSize = 0;
this.m_Buffer = null;
}
GetValueObject(update: boolean = true): CKObject | null {
// Implementation goes here
return null;
}
GetValue(buf: any, update: boolean = true): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
SetValue(buf: any, size: number = 0): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
CopyValue(param: CKParameter, UpdateParam: boolean = true): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
IsCompatibleWith(param: CKParameter): boolean {
// Implementation goes here
return false;
}
GetDataSize(): number {
// Implementation goes here
return 0;
}
GetReadDataPtr(update: boolean = true): any {
// Implementation goes here
return null;
}
GetWriteDataPtr(): any {
// Implementation goes here
return null;
}
SetStringValue(Value: CKSTRING): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
GetStringValue(Value: CKSTRING, update: boolean = true): number {
// Implementation goes here
return 0;
}
GetType(): CKParameterType {
// Implementation goes here
return CKParameterType.INVALID;
}
SetType(type: CKParameterType) {
// Implementation goes here
}
GetGUID(): CKGUID {
// Implementation goes here
return { d1: 0, d2: 0, d3: 0, d4: [0] };
}
SetGUID(guid: CKGUID) {
// Implementation goes here
}
GetParameterClassID(): CK_CLASSID {
// Implementation goes here
return 0;
}
SetOwner(o: CKObject | null) {
// Implementation goes here
}
GetOwner(): CKObject | null {
// Implementation goes here
return this.m_Owner;
}
CheckClass(iType: CKParameterTypeDesc) {
// Implementation goes here
}
Enable(act: boolean = true) {
// Implementation goes here
}
IsEnabled(): boolean {
// Implementation goes here
return false;
}
PreSave(file: CKFile, flags: CKDWORD) {
// Implementation goes here
}
Save(file: CKFile, flags: CKDWORD): CKStateChunk | null {
// Implementation goes here
return null;
}
Load(chunk: CKStateChunk, file: CKFile): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
CheckPostDeletion() {
// Implementation goes here
}
GetMemoryOccupation(): number {
// Implementation goes here
return 0;
}
IsObjectUsed(o: CKObject, cid: CK_CLASSID): boolean {
// Implementation goes here
return false;
}
PrepareDependencies(context: CKDependenciesContext, iCaller: boolean = true): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
RemapDependencies(context: CKDependenciesContext): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
Copy(o: CKObject, context: CKDependenciesContext): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
static GetClassName(): string {
return "CKParameter";
}
static GetDependenciesCount(mode: number): number {
return 0;
}
static GetDependencies(i: number, mode: number): string {
return "";
}
static Register() {
// Implementation goes here
}
static CreateInstance(context: CKContext): CKParameter {
return new CKParameter(context);
}
static ReleaseInstance(context: CKContext, param: CKParameter) {
// Implementation goes here
}
static m_ClassID: CK_CLASSID = 0;
static Cast(iO: CKObject): CKParameter | null {
return CKIsChildClassOf(iO, CKCID.PARAMETER) ? (iO as CKParameter) : null;
}
CreateDefaultValue(): CKERROR {
// Implementation goes here
return CKERROR.SUCCESS;
}
MessageDeleteAfterUse(act: boolean) {
// Implementation goes here
}
GetParameterType(): CKParameterTypeDesc | null {
return this.m_ParamType;
}
IsCandidateForFixedSize(iType: CKParameterTypeDesc): boolean {
// Implementation goes here
return false;
}
}

View File

@ -0,0 +1,270 @@
/*************************************************************************/
/* File : CKParameterIn.h */
/* Author : Nicolas Galinotti */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPARAMETERIN_H
#define CKPARAMETERIN_H
#include "CKObject.h"
#include "CKParameterOut.h"
/**********************************************************************
Name: CKParameterIn
Summary: Input parameters
Remarks:
{Image:ParameterIn}
+ Input parameters allow behaviors to receive values from other behaviors or operations. They have a type defining the type a data they expect.
+ Data is retrieved from an input parameter using the GetReadDataPtr or GetValue methods.
+ An input parameter never owns its data, it always gets it from another parameter,
whether in, out or local (which is a subset of out parameters). So data really is retrieved
from the first output parameter found in the chain of input parameters, named thus the Real Source.
This real source of data may be accessed through the GetRealSource method.
+ The input paramter may be plugged directly into an output parameter from which it will get its data.
This parameter is thus called a DirectSource. This souce can be set using the SetDirectSource method and
accessed using GetDirectSource method.
+ It may also be plugged into another input parameter coming from the enclosing behavior. This input
parameter from the enclosing behavior may be shared by many parameters from inside the behavior.
The method to use to plug the input parameter to such a shared input is ShareSourceWith.
+ The input parameter can only be plugged into a parameter of a compatible type.
+ A CKParameterIn is created with CKBehavior::CreateInputParameter or CKBehavior::InsertInputParameter.You can also use CKContext::CreateParameterIn though this is probably rare.
+ The class id of CKParameterIn is CKCID_PARAMETERIN.
See also: CKBehavior, CKParameterOut, CKParameterOperation
*************************************************/
class CKParameterIn : public CKObject {
friend class CKParameterManager;
friend class CKParameterOut;
public :
/*******************************************
Summary: Copies the input parameter's value into the given buffer
Remarks:
+Retrieves the value of the input parameter and copies it into the given buffer.
+The buffer must have been allocated to the correct size
+The value is retrieved using the usual system: if data has been modified since
the last time it was fetched, the chain of inputs is walked up until an output parameter is found
Returns: CK_OK if success
See Also: GetReadDataPtr, GetLastUpdate
********************************************/
CKERROR GetValue(void *buf)
{
CKParameter* p = GetRealSource();
if (!p) return CKERR_NOTINITIALIZED;
return p->GetValue(buf);
}
/*************************************************
Summary: Retrieves a pointer to the buffer that contain the value.
Returns: A pointer to the data.
Remarks:
+The real pointer to the value is returned.
+This pointer must not be destroyed.
+Using this method can faster than GetValue especially for big parameters
where a memcpy could be avoided.
See also: GetValue, GetLastUpdate
*************************************************/
void *GetReadDataPtr()
{
CKParameter* p = GetRealSource();
if (!p) return NULL;
return p->GetReadDataPtr();
}
/*******************************************
Summary: returns the shared source of the input parameter.
Return Value:
A pointer of the shared CKParameterIn if any, NULL otherwise.
See Also: ShareSourceWith, GetRealSource
********************************************/
CKParameterIn* GetSharedSource()
{
return (!(m_ObjectFlags & CK_PARAMETERIN_SHARED))?NULL:m_InShared;
}
/*******************************************
Summary: Returns the real source of data of the input parameter
Remarks:
+If the input parameter gets its value from a shared source,
the shared source being an input parameter, it itself gets its value from another source. By walking up
the source chain, the real source is the first parameter that is not an input parameter. This is what
GetRealSource does. It returns the real source from which the input gets its value. This real source
is of course an output parameter.
+If the input parameter has a direct source, the real source is the direct source.
Return Value:
A pointer to the CKParameter that stores the data for this input parameter.
See Also: ShareSourceWith
********************************************/
CKParameter* GetRealSource()
{
if (m_ObjectFlags & CK_PARAMETERIN_SHARED) {
if (m_InShared) return m_InShared->GetRealSource();
} else
return m_OutSource;
return NULL;
}
/*******************************************
Summary: Returns the direct source of the input parameter.
Remarks:
+ If the input parameter is plugged into an output parameter, from which it will get its data, this output
parameter is called the direct source.
+ An input parameter must have either a direct source or a shared source, it cannot have both.
Return Value:
A pointer to the CKParameter that stores the data for this input parameter or NULL
if has no direct source.
See Also: GetRealSource,SetDirectSource,ShareSourceWith
********************************************/
CKParameter* GetDirectSource()
{
if (m_ObjectFlags & CK_PARAMETERIN_SHARED) return NULL;
return m_OutSource;
}
CKERROR SetDirectSource(CKParameter* param);
CKERROR ShareSourceWith(CKParameterIn *param);
//-------------------------------------------------
// Type of the data
void SetType(CKParameterType type,CKBOOL UpdateSource=FALSE,CKSTRING NewName=NULL);
void SetGUID(CKGUID guid,CKBOOL UpdateSource=FALSE,CKSTRING NewName=NULL);
/*******************************************
Summary: Returns the type of the input parameter
Return Value:
Returns the index of the type of the input parameter. These
types are maintained by the parameter manager.
See Also: CKParameterIn::GetGUID,CKParameterManager
********************************************/
CKParameterType GetType()
{
if (m_ParamType) return m_ParamType->Index;
else return -1;
}
/*******************************************
Summary: Returns the GUID of the input parameter type.
Return Value:
Returns the GUID of the type of the input parameter.
See Also: CKParameterIn::GetType,CKParameterManager
********************************************/
CKGUID GetGUID()
{
if (m_ParamType) return m_ParamType->Guid;
else return CKGUID(0);
}
/*******************************************
Summary: Sets the owner of the CKParameterIn.
Remarks:
+ You normally shouldn't change the owner of
a CKParameterIn this function being automatically by the framework.
See Also: CKParameterIn::GetOwner
********************************************/
void SetOwner(CKObject *o) {m_Owner = o;}
/*******************************************
Summary: Gets the owner of the CKParameterIn.
Remarks:
+ The owner of the parameter is the object with
wich the parameter will be saved. Typically, the owner
is a parameter operation of a behavior to which it is an input ( or the internal
behavior if the parameter is exported).
Return Value:
A pointer to the CKObject that owns this input parameter usually a CKBehavior or a CKParameterOperation
See Also: CKParameterIn::SetOwner
********************************************/
CKObject *GetOwner() {return m_Owner;}
//-------------------------------------------------------------------
#ifdef DOCJETDUMMY // Docjet secret macro
#else
CKParameterIn(CKContext *Context,CKSTRING name = NULL,int type = NULL);
virtual ~CKParameterIn();
virtual CK_CLASSID GetClassID();
virtual void PreSave(CKFile *file,CKDWORD flags);
virtual CKStateChunk *Save(CKFile *file,CKDWORD flags);
virtual CKERROR Load(CKStateChunk *chunk,CKFile* file);
virtual void PreDelete();
virtual void CheckPreDeletion();
virtual int GetMemoryOccupation();
virtual int IsObjectUsed(CKObject* o,CK_CLASSID cid);
//--------------------------------------------
// Dependencies Functions
virtual CKERROR RemapDependencies(CKDependenciesContext& context);
virtual CKERROR Copy(CKObject& o,CKDependenciesContext& context);
//--------------------------------------------
// Class Registering
static CKSTRING GetClassName();
static int GetDependenciesCount(int mode);
static CKSTRING GetDependencies(int i,int mode);
static void Register();
static CKParameterIn* CreateInstance(CKContext *Context);
static void ReleaseInstance(CKContext* iContext,CKParameterIn*);
static CK_CLASSID m_ClassID;
// Dynamic Cast method (returns NULL if the object can't be casted)
static CKParameterIn* Cast(CKObject* iO)
{
return CKIsChildClassOf(iO,CKCID_PARAMETERIN)?(CKParameterIn*)iO:NULL;
}
void Enable(CKBOOL act=TRUE) {
if (!act) m_ObjectFlags |= CK_PARAMETERIN_DISABLED;
else m_ObjectFlags&=~CK_PARAMETERIN_DISABLED;
}
CKBOOL IsEnabled() {return ((m_ObjectFlags & CK_PARAMETERIN_DISABLED)!=CK_PARAMETERIN_DISABLED);}
protected:
CKObject* m_Owner;
union {
CKParameter* m_OutSource;
CKParameterIn* m_InShared;
};
CKParameterTypeDesc* m_ParamType;
#endif // docjet secret macro
};
#endif

View File

@ -0,0 +1,110 @@
class CKParameterIn extends CKObject {
constructor(Context: CKContext, name: string = null, type: number = null) {
super();
// initialization logic here
}
GetValue(buf: any): CKERROR {
let p = this.GetRealSource();
if (!p) return CKERR_NOTINITIALIZED;
return p.GetValue(buf);
}
GetReadDataPtr(): any {
let p = this.GetRealSource();
if (!p) return null;
return p.GetReadDataPtr();
}
GetSharedSource(): CKParameterIn {
return (!(this.m_ObjectFlags & CK_PARAMETERIN_SHARED)) ? null : this.m_InShared;
}
GetRealSource(): CKParameter {
if (this.m_ObjectFlags & CK_PARAMETERIN_SHARED) {
if (this.m_InShared) return this.m_InShared.GetRealSource();
} else {
return this.m_OutSource;
}
return null;
}
GetDirectSource(): CKParameter {
if (this.m_ObjectFlags & CK_PARAMETERIN_SHARED) return null;
return this.m_OutSource;
}
SetDirectSource(param: CKParameter): CKERROR {
// Method logic here
}
ShareSourceWith(param: CKParameterIn): CKERROR {
// Method logic here
}
SetType(type: CKParameterType, UpdateSource: CKBOOL = false, NewName: CKSTRING = null) {
// Method logic here
}
SetGUID(guid: CKGUID, UpdateSource: CKBOOL = false, NewName: CKSTRING = null) {
// Method logic here
}
GetType(): CKParameterType {
return this.m_ParamType ? this.m_ParamType.Index : -1;
}
GetGUID(): CKGUID {
return this.m_ParamType ? this.m_ParamType.Guid : new CKGUID(0);
}
SetOwner(o: CKObject) {
this.m_Owner = o;
}
GetOwner(): CKObject {
return this.m_Owner;
}
Enable(act: CKBOOL = true) {
if (!act) {
this.m_ObjectFlags |= CK_PARAMETERIN_DISABLED;
} else {
this.m_ObjectFlags &= ~CK_PARAMETERIN_DISABLED;
}
}
IsEnabled(): CKBOOL {
return (this.m_ObjectFlags & CK_PARAMETERIN_DISABLED) !== CK_PARAMETERIN_DISABLED;
}
// Omitted functions for save/load and other internal processing would go here
static GetClassName(): string {
// Method logic here
}
static GetDependenciesCount(mode: number): number {
// Method logic here
}
static GetDependencies(i: number, mode: number): string {
// Method logic here
}
static Register() {
// Method logic here
}
static CreateInstance(Context: CKContext): CKParameterIn {
// Method logic here
}
static ReleaseInstance(iContext: CKContext, instance: CKParameterIn) {
// Method logic here
}
static Cast(iO: CKObject): CKParameterIn {
return CKIsChildClassOf(iO, CKCID_PARAMETERIN) ? iO as CKParameterIn : null;
}
}

View File

@ -0,0 +1,91 @@
/*************************************************************************/
/* File : CKParameterLocal.h */
/* Author : Nicolas Galinotti */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPARAMETERLOCAL_H
#define CKPARAMETERLOCAL_H
#include "CKParameter.h"
/*************************************************************************
Name: CKParameterLocal
Summary: Local parameter providing a value
Remarks:
{Image:ParameterLocal}
+ A CKParameterLocal derives directly from CKParameterOut and differs only by its class ID, it provides no additional methods.
+ A CKParameterLocal is created with CKBehavior::CreateLocalParameter or CKContext::CreateParameterLocal.
+ The class id of CKParameterLocal is CKCID_PARAMETERLOCAL.
See also: CKParameterOut
*****************************************************************************/
class CKParameterLocal : public CKParameter {
public :
//--------------------------------------------
// Special Parameter :: This (MySelf)
void SetAsMyselfParameter(CKBOOL act);
CKBOOL IsMyselfParameter() {return (m_ObjectFlags & CK_PARAMETERIN_THIS);}
virtual void SetOwner(CKObject *o);
virtual CKERROR SetValue(const void *buf,int size = 0);
virtual CKERROR CopyValue(CKParameter *param,CKBOOL UpdateParam=TRUE);
virtual void * GetWriteDataPtr();
virtual CKERROR SetStringValue(CKSTRING Value);
void CheckClass(CKParameterTypeDesc* iType);
//-------------------------------------------------------------------
#ifdef DOCJETDUMMY // Docjet secret macro
#else
//---------------------------------------
// Virtual functions
CKParameterLocal(CKContext *Context,CKSTRING name = NULL);
virtual ~CKParameterLocal();
virtual CK_CLASSID GetClassID();
virtual void PreDelete();
virtual CKStateChunk *Save(CKFile *file,CKDWORD flags);
virtual CKERROR Load(CKStateChunk *chunk,CKFile* file);
virtual int GetMemoryOccupation();
//--------------------------------------------
// Dependencies Functions
virtual CKERROR RemapDependencies(CKDependenciesContext& context);
virtual CKERROR Copy(CKObject& o,CKDependenciesContext& context);
//--------------------------------------------
// Class Registering
static CKSTRING GetClassName();
static int GetDependenciesCount(int mode);
static CKSTRING GetDependencies(int i,int mode);
static void Register();
static CKParameterLocal* CreateInstance(CKContext *Context);
static void ReleaseInstance(CKContext* iContext,CKParameterLocal*);
static CK_CLASSID m_ClassID;
// Dynamic Cast method (returns NULL if the object can't be casted)
static CKParameterLocal* Cast(CKObject* iO)
{
return CKIsChildClassOf(iO,CKCID_PARAMETERLOCAL)?(CKParameterLocal*)iO:NULL;
}
#endif // docjet secret macro
};
#endif

View File

@ -0,0 +1,43 @@
class CKParameterLocal extends CKParameter {
SetAsMyselfParameter(act: boolean): void;
IsMyselfParameter(): boolean {
return (this.m_ObjectFlags & CK_PARAMETERIN_THIS) !== 0;
}
SetOwner(o: CKObject): void;
SetValue(buf: any, size?: number): CKERROR;
CopyValue(param: CKParameter, UpdateParam?: boolean): CKERROR;
GetWriteDataPtr(): any;
SetStringValue(Value: string): CKERROR;
CheckClass(iType: CKParameterTypeDesc): void;
constructor(Context: CKContext, name?: string);
destructor();
GetClassID(): CK_CLASSID;
PreDelete(): void;
Save(file: CKFile, flags: number): CKStateChunk;
Load(chunk: CKStateChunk, file: CKFile): CKERROR;
GetMemoryOccupation(): number;
RemapDependencies(context: CKDependenciesContext): CKERROR;
Copy(o: CKObject, context: CKDependenciesContext): CKERROR;
static GetClassName(): string;
static GetDependenciesCount(mode: number): number;
static GetDependencies(i: number, mode: number): string;
static Register(): void;
static CreateInstance(Context: CKContext): CKParameterLocal;
static ReleaseInstance(iContext: CKContext, instance: CKParameterLocal): void;
static m_ClassID: CK_CLASSID;
static Cast(iO: CKObject): CKParameterLocal | null {
return CKIsChildClassOf(iO, CKCID_PARAMETERLOCAL) ? (iO as CKParameterLocal) : null;
}
}

View File

@ -0,0 +1,335 @@
/*************************************************************************/
/* File : CKParameterManager.h */
/* Author : Romain Sididris */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPARAMETERMANAGER_H
#define CKPARAMETERMANAGER_H "$Id:$"
#include "CKParameterIn.h"
#include "CKParameterOut.h"
#include "CKParameterLocal.h"
#include "CKContext.h"
/********************************************************
Kept for compatibility issues : On macintosh the
const CKGUID& must be used to conform to Codewarrior, On PC
we do not need to to this (and must not to keep CK2 compatible
with previously created DLLs) {secret}
*********************************************************/
#ifdef macintosh
#define CKGUIDCONSTREF const CKGUID&
#define CKGUIDREF const CKGUID&
#else
#define CKGUIDCONSTREF CKGUID
#define CKGUIDREF CKGUID&
#endif
typedef XHashTable<int,CKGUID> XHashGuidToType;
/***********************************************************
Summary: Helper class to access a parameter of type structure.
Remarks:
+ New parameter types can be created like structures with the
CKParameterManager::RegisterNewStructure method, this class provides
method to easily access a structure members.
+ A structure defined in C like this:
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
typedef struct MyStructure
{
float Priority;
VxVector Position;
CK_ID ObstacleId;
} MyStructure;
{html:</td></tr></table>}
is equivalent to declare
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
#define CKPGUID_MYSTRUCT CKGUID(0x4a893652,0x76e72d5c)
ParameterManager->RegisterNewStructure(CKPGUID_MYSTRUCT,"MyStructure","Priority,Position,Obstacle",CKPGUID_FLOAT,CKPGUID_VECTOR,CKPGUID_3DENTITY);
{html:</td></tr></table>}
then the CKStructHelper can help to have a description of this structure later :
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
CKStructHelper StructDesc(Context,CKPGUID_MYSTRUCT);
int Count = StructDesc.GetMemberCount();
for (int i=0;i<Count;++i) {
StructDesc.GetMemberName(i); // Priority,Position,Obstacle
StructDesc.GetMemberGUID(i); // CKPGUID_FLOAT,CKPGUID_VECTOR,CKPGUID_3DENTITY
}
{html:</td></tr></table>}
or it can be use to access the sub-members of a parameter of the type CKPGUID_MYSTRUCT for example:
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
CKStructHelper MyStruct(param);
Access sub-members
float Priority;
VxVector Position;
CK_ID ObstacleId;
MyStruct[0]->GetValue(&Priority);
MyStruct[1]->GetValue(&Position);
MyStruct[2]->GetValue(&ObstacleId);
{html:</td></tr></table>}
See Also: RegisterNewStructure,
************************************************************/
class CKStructHelper {
public:
CKStructHelper(CKParameter* Param, CKBOOL Update = TRUE);
CKStructHelper(CKContext* ctx,CKGUID PGuid,CK_ID* Data = NULL);
CKStructHelper(CKContext* ctx,CKParameterType PType,CK_ID* Data = NULL);
//------- Members description (These methods do not require
// Data pointer to be valid )
char* GetMemberName(int Pos);
CKGUID GetMemberGUID(int Pos);
int GetMemberCount();
/************************************************************
Summary: Returns a member of this structure as a parameter
Arguments:
i: Index of the member to return.
Return Value:
A pointer to a CKParameter that holds the ith member.
Remarks:
This method does not perform any check concerning the validty of the given index, it is
the user responsability to ensure it is below GetMemberCount
See also:GetMemberGUID,GetMemberName,GetMemberCount
*****************************************************************************/
CKParameter* operator[] (int i)
{
return (CKParameter*)m_Context->GetObject(m_SubIDS[i]);
}
protected:
CKContext* m_Context;
CKStructStruct* m_StructDescription;
CK_ID* m_SubIDS;
};
/*************************************************
Summary: Description of an available parametric operation.
Remarks:
+ The CKParameterManager::GetAvailableOperationsDesc fills an array
of this structure according to search criteria. The 4 CKGUID defines the
parameter operation and the Fct member is the function the engine will
call to process the operation.
See also: CKParameterManager::GetAvailableOperationsDesc
*************************************************/
typedef struct CKOperationDesc {
CKGUID OpGuid; // Operation GUID
CKGUID P1Guid; // Input Parameter 1 GUID
CKGUID P2Guid; // Input Parameter 2 GUID
CKGUID ResGuid; // Output Parameter GUID
CK_PARAMETEROPERATION Fct; // Function to call to process the operation.
} CKOperationDesc;
struct TreeCell;
struct OperationCell;
/************************************************************************
Name: CKParameterManager
Summary: Parameter and operation types management
Remarks:
+ There is only one instance of the CKParameterManager per context, which can
be accessed using the CKContext::GetParameterManager global function. It manages the list of parameter types,
and the list of operation types. It gives access to the creation and registration of new operations, and
overwriting of existing operations.
+ Operations are subdivided into families, where members of a family of operations all
perform the same kind of operations on different types of parameters. For example, you can
add floats and also imagine adding 3D entities.
In order to define a new operation type, its family should first be registered, then its function should
be declared. When a family is unregistered, all the operations of that family are unregistered too. In all
cases the name argument is provided as a conveniency for debugging and display purposes.
See Also: CKParameterOperation, CKParameter,CKParameterIn, CKParameterOut,ParameterOperation Types,Pre-Registred Parameter Types
********************************************/
class CKParameterManager : public CKBaseManager {
friend class CKParameter;
public :
//-----------------------------------------------------------------------
// Parameter Types registration
CKERROR RegisterParameterType(CKParameterTypeDesc *param_type);
CKERROR UnRegisterParameterType(CKGUIDCONSTREF guid);
CKParameterTypeDesc* GetParameterTypeDescription(int type);
CKParameterTypeDesc* GetParameterTypeDescription(CKGUIDCONSTREF guid);
int GetParameterSize(CKParameterType type);
int GetParameterTypesCount();
CKERROR ChangeParametersGuid(CKGUIDCONSTREF iOldGuid,CKGUIDCONSTREF iNewGuid);
//-----------------------------------------------------------------------
// Parameter Types <=> Parameter Type Name <=> GUID conversion functions
CKParameterType ParameterGuidToType(CKGUIDCONSTREF guid);
CKSTRING ParameterGuidToName(CKGUIDCONSTREF guid);
CKGUID ParameterTypeToGuid(CKParameterType type);
CKSTRING ParameterTypeToName(CKParameterType type);
CKGUID ParameterNameToGuid(CKSTRING name);
CKParameterType ParameterNameToType(CKSTRING name);
///----------------------------------------------------------------------
// Dervated types functions
CKBOOL IsDerivedFrom(CKGUIDCONSTREF guid1,CKGUIDCONSTREF parent);
CKBOOL IsDerivedFrom(CKParameterType child,CKParameterType parent);
CKBOOL IsTypeCompatible(CKGUIDCONSTREF guid1,CKGUIDCONSTREF guid2);
CKBOOL IsTypeCompatible(CKParameterType Ptype1,CKParameterType Ptype2);
//-----------------------------------------------------------------------
// Parameter Type to Class ID conversions functions
CK_CLASSID TypeToClassID(CKParameterType type);
CK_CLASSID GuidToClassID(CKGUIDCONSTREF guid);
CKParameterType ClassIDToType(CK_CLASSID cid);
CKGUID ClassIDToGuid(CK_CLASSID cid);
//-----------------------------------------------------------------------
// Special Types : Flags,enums and Structures
CKERROR RegisterNewFlags(CKGUIDCONSTREF FlagsGuid,CKSTRING FlagsName,CKSTRING FlagsData);
CKERROR RegisterNewEnum(CKGUIDCONSTREF EnumGuid,CKSTRING EnumName,CKSTRING EnumData);
CKERROR ChangeEnumDeclaration(CKGUIDCONSTREF EnumGuid,CKSTRING EnumData);
CKERROR ChangeFlagsDeclaration(CKGUIDCONSTREF FlagsGuid,CKSTRING FlagsData);
CKERROR RegisterNewStructure(CKGUIDCONSTREF StructGuid,CKSTRING StructName,CKSTRING Structdata,...);
CKERROR RegisterNewStructure(CKGUIDCONSTREF StructGuid,CKSTRING StructName,CKSTRING StructData,XArray<CKGUID>& ListGuid);
CKERROR GetEnumBuildString(CKParameterType pType,XString& oBuildString);
CKERROR GetFlagBuildString(CKParameterType pType,XString& oBuildString);
int GetNbFlagDefined();
int GetNbEnumDefined();
int GetNbStructDefined();
CKFlagsStruct* GetFlagsDescByType(CKParameterType pType);
CKEnumStruct* GetEnumDescByType(CKParameterType pType);
CKStructStruct* GetStructDescByType(CKParameterType pType);
//------------ Parameter Operations -------------------------------------//
//-----------------------------------------------------------------------
// Operation Family Registration
CKOperationType RegisterOperationType(CKGUIDCONSTREF OpCode,CKSTRING name);
CKERROR UnRegisterOperationType(CKGUIDCONSTREF opguid);
CKERROR UnRegisterOperationType(CKOperationType opcode);
//-----------------------------------------------------------------------
// Operation function acces
#if defined(PSX2) || defined(__MWERKS__)
CKERROR RegisterOperationFunction(CKGUID operation,CKGUID type_paramres,CKGUID type_param1,CKGUID type_param2,CK_PARAMETEROPERATION op);
#else
CKERROR RegisterOperationFunction(CKGUIDREF operation,CKGUIDREF type_paramres,CKGUIDREF type_param1,CKGUIDREF type_param2,CK_PARAMETEROPERATION op);
#endif
CK_PARAMETEROPERATION GetOperationFunction(CKGUIDREF operation,CKGUIDREF type_paramres,CKGUIDREF type_param1,CKGUIDREF type_param2);
CKERROR UnRegisterOperationFunction(CKGUIDREF operation,CKGUIDREF type_paramres,CKGUIDREF type_param1,CKGUIDREF type_param2);
//-----------------------------------------------------------------------
// operation type conversion functions : Name <-> GUID <-> internal code for operation
CKGUID OperationCodeToGuid(CKOperationType type);
CKSTRING OperationCodeToName(CKOperationType type);
CKOperationType OperationGuidToCode(CKGUIDCONSTREF guid);
CKSTRING OperationGuidToName(CKGUIDCONSTREF guid);
CKGUID OperationNameToGuid(CKSTRING name);
CKOperationType OperationNameToCode(CKSTRING name);
int GetAvailableOperationsDesc(const CKGUID &opGuid,
CKParameterOut *res,
CKParameterIn *p1,
CKParameterIn *p2,
CKOperationDesc *list);
int GetParameterOperationCount();
CKBOOL IsParameterTypeToBeShown(CKParameterType type);
CKBOOL IsParameterTypeToBeShown(CKGUIDCONSTREF guid);
CKBOOL CheckParamTypeValidity(CKParameterType type);
CKParameterManager(CKContext *Context);
~CKParameterManager();
void UpdateParameterEnum();
CKBOOL m_ParameterTypeEnumUpToDate;
//---Called to save manager data. return NULL if nothing to save...
virtual CKStateChunk* SaveData(CKFile* SavedFile);
//---Called to load manager data.
virtual CKERROR LoadData(CKStateChunk *chunk,CKFile* LoadedFile);
protected :
XArray<CKParameterTypeDesc*> m_RegistredTypes;
int m_NbOperations,m_NbAllocatedOperations;
OperationCell* m_OperationTree;
XHashGuidToType m_ParamGuids;
XHashGuidToType m_OpGuids;
BOOL m_DerivationMasksUpTodate;
int m_NbFlagsDefined;
CKFlagsStruct* m_Flags;
int m_NbStructDefined;
CKStructStruct* m_Structs;
int m_NbEnumsDefined;
CKEnumStruct* m_Enums;
CKBOOL CheckOpCodeValidity(CKOperationType type);
private:
CKBOOL GetParameterGuidParentGuid(CKGUID child,CKGUID& parent);
void UpdateDerivationTables();
void RecurseDeleteParam(TreeCell *cell,CKGUID param);
int DichotomicSearch(int start,int end,TreeCell *tab,CKGUID key);
void RecurseDelete(TreeCell *cell);
CKBOOL IsDerivedFromIntern(int child,int parent);
CKBOOL RemoveAllParameterTypes();
CKBOOL RemoveAllOperations();
int m_ReplaceDuplicateUserFlagEnum;
};
#endif

View File

@ -0,0 +1,335 @@
type CKGUID = any; // Substitute with actual type
type CKBOOL = boolean; // Substitute with actual type
type CKParameterType = any; // Substitute with actual type
type CKSTRING = string;
type CK_ID = any; // Substitute with actual type
type CK_PARAMETEROPERATION = any; // Substitute with actual type
type CKOperationType = any; // Substitute with actual type
type CK_CLASSID = any; // Substitute with actual type
type CKBaseManager = any; // Substitute with actual type
type CKParameter = any; // Substitute with actual type
type CKContext = any; // Substitute with actual type
type CKError = any; // Substitute with actual type
type CKStateChunk = any; // Substitute with actual type
type CKFile = any; // Substitute with actual type
type CKFlagsStruct = any; // Substitute with actual type
type CKEnumStruct = any; // Substitute with actual type
type CKStructStruct = any; // Substitute with actual type
class CKStructHelper {
m_Context: CKContext;
m_StructDescription: CKStructStruct;
m_SubIDS: CK_ID[];
constructor(param: CKParameter | CKContext, guidOrUpdate?: CKGUID | CKBOOL, data?: CK_ID) {
if (param instanceof CKParameter) {
// Initialization for CKParameter
} else {
// Initialization for CKContext
}
}
GetMemberName(pos: number): string {
// Implementation
return '';
}
GetMemberGUID(pos: number): CKGUID {
// Implementation
return {} as CKGUID;
}
GetMemberCount(): number {
// Implementation
return 0;
}
[i: number]: CKParameter {
return this.m_Context.GetObject(this.m_SubIDS[i]) as CKParameter;
}
}
interface CKOperationDesc {
OpGuid: CKGUID;
P1Guid: CKGUID;
P2Guid: CKGUID;
ResGuid: CKGUID;
Fct: CK_PARAMETEROPERATION;
}
class CKParameterManager extends CKBaseManager {
m_Context: CKContext;
m_ParameterTypeEnumUpToDate: CKBOOL;
m_RegistredTypes: any[]; // Substitute with actual type
m_NbOperations: number;
m_NbAllocatedOperations: number;
m_OperationTree: OperationCell;
m_ParamGuids: XHashTable<number, CKGUID>;
m_OpGuids: XHashTable<number, CKGUID>;
m_DerivationMasksUpTodate: boolean;
m_NbFlagsDefined: number;
m_Flags: CKFlagsStruct;
m_NbStructDefined: number;
m_Structs: CKStructStruct;
m_NbEnumsDefined: number;
m_Enums: CKEnumStruct;
private m_ReplaceDuplicateUserFlagEnum: number;
constructor(context: CKContext) {
super();
// Initialization
}
RegisterParameterType(param_type: any): CKError {
// Implementation
return {} as CKError;
}
UnRegisterParameterType(guid: CKGUID): CKError {
// Implementation
return {} as CKError;
}
GetParameterTypeDescription(type: number): any {
// Implementation
return {};
}
GetParameterTypeDescription(guid: CKGUID): any {
// Implementation
return {};
}
GetParameterSize(type: CKParameterType): number {
// Implementation
return 0;
}
GetParameterTypesCount(): number {
// Implementation
return 0;
}
ChangeParametersGuid(iOldGuid: CKGUID, iNewGuid: CKGUID): CKError {
// Implementation
return {} as CKError;
}
ParameterGuidToType(guid: CKGUID): CKParameterType {
// Implementation
return {} as CKParameterType;
}
ParameterGuidToName(guid: CKGUID): CKSTRING {
// Implementation
return '';
}
ParameterTypeToGuid(type: CKParameterType): CKGUID {
// Implementation
return {} as CKGUID;
}
ParameterTypeToName(type: CKParameterType): CKSTRING {
// Implementation
return '';
}
ParameterNameToGuid(name: CKSTRING): CKGUID {
// Implementation
return {} as CKGUID;
}
ParameterNameToType(name: CKSTRING): CKParameterType {
// Implementation
return {} as CKParameterType;
}
IsDerivedFrom(guid1: CKGUID, parent: CKGUID): CKBOOL {
// Implementation
return false;
}
IsDerivedFrom(child: CKParameterType, parent: CKParameterType): CKBOOL {
// Implementation
return false;
}
IsTypeCompatible(guid1: CKGUID, guid2: CKGUID): CKBOOL {
// Implementation
return false;
}
IsTypeCompatible(ptype1: CKParameterType, ptype2: CKParameterType): CKBOOL {
// Implementation
return false;
}
TypeToClassID(type: CKParameterType): CK_CLASSID {
// Implementation
return {} as CK_CLASSID;
}
GuidToClassID(guid: CKGUID): CK_CLASSID {
// Implementation
return {} as CK_CLASSID;
}
ClassIDToType(cid: CK_CLASSID): CKParameterType {
// Implementation
return {} as CKParameterType;
}
ClassIDToGuid(cid: CK_CLASSID): CKGUID {
// Implementation
return {} as CKGUID;
}
RegisterNewFlags(FlagsGuid: CKGUID, FlagsName: CKSTRING, FlagsData: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
RegisterNewEnum(EnumGuid: CKGUID, EnumName: CKSTRING, EnumData: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
ChangeEnumDeclaration(EnumGuid: CKGUID, EnumData: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
ChangeFlagsDeclaration(FlagsGuid: CKGUID, FlagsData: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
RegisterNewStructure(StructGuid: CKGUID, StructName: CKSTRING, Structdata: CKSTRING, ...args: any[]): CKError {
// Implementation
return {} as CKError;
}
GetEnumBuildString(pType: CKParameterType, oBuildString: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
GetFlagBuildString(pType: CKParameterType, oBuildString: CKSTRING): CKError {
// Implementation
return {} as CKError;
}
GetNbFlagDefined(): number {
// Implementation
return 0;
}
GetNbEnumDefined(): number {
// Implementation
return 0;
}
GetNbStructDefined(): number {
// Implementation
return 0;
}
GetFlagsDescByType(pType: CKParameterType): CKFlagsStruct {
// Implementation
return {} as CKFlagsStruct;
}
GetEnumDescByType(pType: CKParameterType): CKEnumStruct {
// Implementation
return {} as CKEnumStruct;
}
GetStructDescByType(pType: CKParameterType): CKStructStruct {
// Implementation
return {} as CKStructStruct;
}
RegisterOperationType(OpCode: CKGUID, name: CKSTRING): CKOperationType {
// Implementation
return {} as CKOperationType;
}
UnRegisterOperationType(opguid: CKGUID): CKError {
// Implementation
return {} as CKError;
}
UnRegisterOperationType(opcode: CKOperationType): CKError {
// Implementation
return {} as CKError;
}
RegisterOperationFunction(operation: CKGUID, type_paramres: CKGUID, type_param1: CKGUID, type_param2: CKGUID, op: CK_PARAMETEROPERATION): CKError {
// Implementation
return {} as CKError;
}
GetOperationFunction(operation: CKGUID, type_paramres: CKGUID, type_param1: CKGUID, type_param2: CKGUID): CK_PARAMETEROPERATION {
// Implementation
return {} as CK_PARAMETEROPERATION;
}
UnRegisterOperationFunction(operation: CKGUID, type_paramres: CKGUID, type_param1: CKGUID, type_param2: CKGUID): CKError {
// Implementation
return {} as CKError;
}
OperationCodeToGuid(type: CKOperationType): CKGUID {
// Implementation
return {} as CKGUID;
}
OperationCodeToName(type: CKOperationType): CKSTRING {
// Implementation
return '';
}
OperationGuidToCode(guid: CKGUID): CKOperationType {
// Implementation
return {} as CKOperationType;
}
OperationGuidToName(guid: CKGUID): CKSTRING {
// Implementation
return '';
}
OperationNameToGuid(name: CKSTRING): CKGUID {
// Implementation
return {} as CKGUID;
}
OperationNameToCode(name: CKSTRING): CKOperationType {
// Implementation
return {} as CKOperationType;
}
GetAvailableOperationsDesc(opGuid: CKGUID, res: any, p1: any, p2: any, list: CKOperationDesc[]): number {
// Implementation
return 0;
}
GetParameterOperationCount(): number {
// Implementation
return 0;
}
IsParameterTypeToBeShown(type: CKParameterType): boolean {
// Implementation
return false;
}
IsParameterTypeToBeShown(guid: CKGUID): boolean {
// Implementation
return false;
}
CheckParamTypeValidity(type: CKParameterType): boolean {
// Implementation
return false;
}
UpdateParameterEnum(): void {
// Implementation
}
SaveData(SavedFile: CKFile): CKStateChunk | null {
// Implementation
return null;
}
LoadData(chunk: CKStateChunk, LoadedFile: CKFile): CKError {
// Implementation
return {} as CKError;
}
CheckOpCodeValidity(type: CKOperationType): boolean {
// Implementation
return false;
}
GetParameterGuidParentGuid(child: CKGUID, parent: CKGUID): CKBOOL {
// Implementation
return false;
}
UpdateDerivationTables(): void {
// Implementation
}
RecurseDeleteParam(cell: TreeCell, param: CKGUID): void {
// Implementation
}
DichotomicSearch(start: number, end: number, tab: TreeCell, key: CKGUID): number {
// Implementation
return 0;
}
RecurseDelete(cell: TreeCell): void {
// Implementation
}
IsDerivedFromIntern(child: number, parent: number): CKBOOL {
// Implementation
return false;
}
RemoveAllParameterTypes(): CKBOOL {
// Implementation
return false;
}
RemoveAllOperations(): CKBOOL {
// Implementation
return false;
}
private m_ReplaceDuplicateUserFlagEnum: number; // Implementation
}
interface TreeCell { /* ... */ }
interface OperationCell { /* ... */ }

View File

@ -0,0 +1,171 @@
/*************************************************************************/
/* File : CKParameterOperation.h */
/* Author : Nicolas Galinotti */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPARAMETEROPERATION_H
#define CKPARAMETEROPERATION_H "$Id:$"
#include "CKObject.h"
/****************************************************************************
Name: CKParameterOperation
Summary: Performing operations on parameters
Remarks:
{Image:ParameterOperation}
+ An operation encapsulates a C++ function that applies on zero, one or two input parameters,
and outputs one parameter. Certain operations are predefined in Virtools and you can define your own.
The function is called only when necessary (GetValue on the output parameter for example).
+ All the operation's characteristics are defined by the CKParameterManager, and by
the GUID of the operation. You can defined your own operation with CKParameterManager::RegisterOperationType
and your own operation function with CKParameterManager::RegisterOperationFunction.
+ An operation has zero, one or two input parameters that it owns. These parameters can be plugged into
output parameters to retrieve their value for example. The output parameter is also owned by the operation,
and is used to make the result of the operation available to the rest of the graph. One can access
the parameters with the GetInParameter1, GetInParameter2 and GetOutParameter methods.
+ The execution of the operation is automatically done when needed. You can force it by using the DoOperation method.
In any case, the operation checks the update times of the inputs parameters and only does the computation if necessary.
+ The class id of CKParameterOperation is CKCID_PARAMETEROPERATION.
See also: CKParameterManager, CKParameterOut, CKParameterIn, CKBehaviorPrototype,ParameterOperation Types
*********************************************************************************/
class CKParameterOperation:public CKObject {
friend class CKBehavior;
friend class CKParameterIn;
friend class CKParameterOut;
public :
/*************************************************
Summary: Accessing the first input parameter of the operation
Return Value:
A pointer to the first input parameter.
Remarks:
The parameters of the operation are created with the operation, and are owned by it. These methods
give access to these parameters.
See Also: GetInParameter2,GetOutParameter
*************************************************/
CKParameterIn* GetInParameter1() {return m_In1;}
/*************************************************
Summary: Accessing the second input parameter of the operation
Return Value:
A pointer to the second input parameter.
Remarks:
The parameters of the operation are created with the operation, and are owned by it. These methods
give access to these parameters.
See Also: GetInParameter1,GetOutParameter
*************************************************/
CKParameterIn* GetInParameter2() {return m_In2;}
/*************************************************
Summary: Accessing the output parameter of the operation
Return Value:
A pointer to the output parameter.
Remarks:
The parameters of the operation are created with the operation, and are owned by it. These methods
give access to these parameters.
See Also: GetInParameter1,GetInParameter2
*************************************************/
CKParameterOut* GetOutParameter() {return m_Out;}
/*************************************************
Summary: Returns the owner behavior.
Return Value:
A pointer to the CKBehavior that owns this parameter operation.
Remarks:
+ The owner is usually the behavior which owns the graph of which the operation is part of.
See also: CKBehavior::AddParameterOperation
*************************************************/
CKBehavior* GetOwner() {
return m_Owner;
}
/*************************************************
Summary: Owner management
Remarks:
The owner is usually the behavior which owns the graph of which the operation is part of.
See also: CKBehavior::AddParameterOperation
*************************************************/
void SetOwner(CKBehavior* beh) {m_Owner = beh;}
//------------------------------------------------
// Execution
CKERROR DoOperation();
//------------------------------------------------
// Guid
CKGUID GetOperationGuid();
void Reconstruct(CKSTRING Name,CKGUID opguid,CKGUID ResGuid, CKGUID p1Guid, CKGUID p2Guid);
//-------------------------------------------------------------------
#ifdef DOCJETDUMMY // Docjet secret macro
#else
CK_PARAMETEROPERATION GetOperationFunction();
//------------------------------------------------
// Virtual functions
CKParameterOperation(CKContext *Context,CKSTRING name=NULL);
CKParameterOperation(CKContext *Context,CKSTRING name,CKGUID OpGuid,CKGUID ResGuid,CKGUID P1Guid,CKGUID P2Guid);
virtual ~CKParameterOperation();
virtual CK_CLASSID GetClassID();
virtual void PreSave(CKFile *file,CKDWORD flags);
virtual CKStateChunk *Save(CKFile *file,CKDWORD flags);
virtual CKERROR Load(CKStateChunk *chunk,CKFile* file);
virtual void PostLoad();
virtual void PreDelete();
virtual int GetMemoryOccupation();
virtual int IsObjectUsed(CKObject* o,CK_CLASSID cid);
//--------------------------------------------
// Dependencies Functions
virtual CKERROR PrepareDependencies(CKDependenciesContext& context, CKBOOL iCaller = TRUE);
virtual CKERROR RemapDependencies(CKDependenciesContext& context);
virtual CKERROR Copy(CKObject& o,CKDependenciesContext& context);
//--------------------------------------------
// Class Registering
static CKSTRING GetClassName();
static int GetDependenciesCount(int mode);
static CKSTRING GetDependencies(int i,int mode);
static void Register();
static CKParameterOperation* CreateInstance(CKContext *Context);
static void ReleaseInstance(CKContext* iContext,CKParameterOperation*);
static CK_ID m_ClassID;
// Dynamic Cast method (returns NULL if the object can't be casted)
static CKParameterOperation* Cast(CKObject* iO)
{
return CKIsChildClassOf(iO,CKCID_PARAMETEROPERATION)?(CKParameterOperation*)iO:NULL;
}
protected :
CKParameterIn* m_In1;
CKParameterIn* m_In2;
CKParameterOut* m_Out;
CKBehavior* m_Owner;
static CKSTRING m_In1Name;
static CKSTRING m_In2Name;
static CKSTRING m_OutName;
#endif // docjet secret macro
};
#endif

View File

@ -0,0 +1,118 @@
class CKParameterOperation extends CKObject {
private m_In1: CKParameterIn;
private m_In2: CKParameterIn;
private m_Out: CKParameterOut;
private m_Owner: CKBehavior;
static m_In1Name: string;
static m_In2Name: string;
static m_OutName: string;
static m_ClassID: CK_ID;
constructor(context: CKContext, name: string = null, opGuid?: CKGUID, resGuid?: CKGUID, p1Guid?: CKGUID, p2Guid?: CKGUID) {
super();
}
GetInParameter1(): CKParameterIn {
return this.m_In1;
}
GetInParameter2(): CKParameterIn {
return this.m_In2;
}
GetOutParameter(): CKParameterOut {
return this.m_Out;
}
GetOwner(): CKBehavior {
return this.m_Owner;
}
SetOwner(beh: CKBehavior) {
this.m_Owner = beh;
}
DoOperation(): CKERROR {
//
}
GetOperationGuid(): CKGUID {
//
}
Reconstruct(name: string, opGuid: CKGUID, resGuid: CKGUID, p1Guid: CKGUID, p2Guid: CKGUID) {
//
}
static Cast(iO: CKObject): CKParameterOperation {
return CKIsChildClassOf(iO, CKCID_PARAMETEROPERATION) ? <CKParameterOperation>iO : null;
}
static GetClassName(): string {
//
}
static GetDependenciesCount(mode: number): number {
//
}
static GetDependencies(i: number, mode: number): string {
//
}
static Register() {
//
}
static CreateInstance(context: CKContext): CKParameterOperation {
//
}
static ReleaseInstance(iContext: CKContext, instance: CKParameterOperation) {
//
}
GetClassID(): CK_CLASSID {
//
}
PreSave(file: CKFile, flags: number): void {
//
}
Save(file: CKFile, flags: number): CKStateChunk {
//
}
Load(chunk: CKStateChunk, file: CKFile): CKERROR {
//
}
PostLoad(): void {
//
}
PreDelete(): void {
//
}
GetMemoryOccupation(): number {
//
}
IsObjectUsed(o: CKObject, cid: CK_CLASSID): number {
//
}
PrepareDependencies(context: CKDependenciesContext, iCaller: boolean = true): CKERROR {
//
}
RemapDependencies(context: CKDependenciesContext): CKERROR {
//
}
Copy(o: CKObject, context: CKDependenciesContext): CKERROR {
//
}
}

View File

@ -0,0 +1,128 @@
/*************************************************************************/
/* File : CKParameterOut.h */
/* Author : Nicolas Galinotti */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPARAMETEROUT_H
#define CKPARAMETEROUT_H
#include "CKParameter.h"
/**************************************************************************
Name: CKParameterOut
Summary: Output parameter providing a value
Remarks:
{Image:ParameterOut}
+ The type of the parameter defines the type of the data provided. These types are maintained by
the parameter manager. It defines the size of the buffer to use, and also decides what can be plugged
onto the output parameter. To have the list and definition of predefined parameter types see CKParameterManager.
+ An output parameter may have destinations to which it pushes the data each time it is changed.
These destinations are other output parameters, which for example provide their value out of the enclosing
behavior, or local parameters which provide values to other parts of the graph of sub-behaviors.
These destinations are managed using the AddDestination and related methods.
When the data of the output parameter changes, it pushes the new value down to
its destinations.
+ An output parameter will probably also be plugged into input parameters. These input parameters will pull the
value from the output parameter when needed.
+ An output parameter usually knows how to write its data from and to a string. This is useful for display
and debugging purposes. When you define a new type of parameter, you can specify the function that converts
to and from strings.
+ An output parameter can also have an edition window. When you define a new type of parameter, you can specify the
function that will create the edition window when needed by the interface.
+ A CKParameterOut is created with CKBehavior::CreateOutputParameter or CKContext::CreateCKParameterOut.
+ The class id of CKParameterOut is CKCID_PARAMETEROUT.
See also: CKBehavior, CKParameterIn, CKParameterOperation
**********************************************************************************/
class CKParameterOut : public CKParameter {
friend class CKParameterIn;
friend class CKParameter;
friend class CKParameterFS;
friend class CKParameterLocalFS;
friend class CKParameterManager;
public :
//--------------------------------------------
// Value
virtual CKERROR GetValue(void *buf, CKBOOL update = TRUE);
virtual CKERROR SetValue(const void *buf,int size = 0);
virtual CKERROR CopyValue(CKParameter *param,CKBOOL UpdateParam=TRUE);
virtual void* GetReadDataPtr(CKBOOL update = TRUE);
virtual int GetStringValue(CKSTRING Value,CKBOOL update = TRUE);
void CheckClass(CKParameterTypeDesc* iType);
//--------------------------------------------
// Destinations
void DataChanged();
CKERROR AddDestination(CKParameter* param,CKBOOL CheckType=TRUE);
void RemoveDestination(CKParameter* param);
int GetDestinationCount();
CKParameter* GetDestination(int pos);
void RemoveAllDestinations();
//-------------------------------------------------------------------
// Internal functions
#ifdef DOCJETDUMMY // Docjet secret macro
#else
//--------------------------------------------
// Virtual functions
CKParameterOut(CKContext *Context,CKSTRING name = NULL);
virtual ~CKParameterOut();
virtual CK_CLASSID GetClassID();
virtual void PreSave(CKFile *file,CKDWORD flags);
virtual CKStateChunk *Save(CKFile *file,CKDWORD flags);
virtual CKERROR Load(CKStateChunk *chunk,CKFile* file);
virtual void PreDelete();
virtual void CheckPreDeletion();
virtual int GetMemoryOccupation();
virtual int IsObjectUsed(CKObject* o,CK_CLASSID cid);
//--------------------------------------------
// Dependencies Functions
virtual CKERROR RemapDependencies(CKDependenciesContext& context);
virtual CKERROR Copy(CKObject& o,CKDependenciesContext& context);
//--------------------------------------------
// Class Registering
static CKSTRING GetClassName();
static int GetDependenciesCount(int mode);
static CKSTRING GetDependencies(int i,int mode);
static void Register();
static CKParameterOut* CreateInstance(CKContext *Context);
static void ReleaseInstance(CKContext* iContext,CKParameterOut*);
static CK_CLASSID m_ClassID;
// Dynamic Cast method (returns NULL if the object can't be casted)
static CKParameterOut* Cast(CKObject* iO)
{
return CKIsChildClassOf(iO,CKCID_PARAMETEROUT)?(CKParameterOut*)iO:NULL;
}
void Update();
protected:
XSObjectPointerArray m_Destinations;
#endif // docjet secret macro
};
#endif

View File

@ -0,0 +1,69 @@
class CKParameterOut extends CKParameter {
constructor(protected context: CKContext, name: string | null = null) {
super();
}
CheckClass(iType: CKParameterTypeDesc): void {}
GetValue(buf: any, update: boolean = true): CKERROR { return CKERROR.NONE; }
SetValue(buf: any, size: number = 0): CKERROR { return CKERROR.NONE; }
CopyValue(param: CKParameter, UpdateParam: boolean = true): CKERROR { return CKERROR.NONE; }
GetReadDataPtr(update: boolean = true): any { return null; }
GetStringValue(Value: CKSTRING, update: boolean = true): number { return 0; }
DataChanged(): void {}
AddDestination(param: CKParameter, CheckType = true): CKERROR { return CKERROR.NONE; }
RemoveDestination(param: CKParameter): void {}
GetDestinationCount(): number { return 0; }
GetDestination(pos: number): CKParameter | null { return null; }
RemoveAllDestinations(): void {}
PreSave(file: CKFile, flags: CKDWORD): void {}
Save(file: CKFile, flags: CKDWORD): CKStateChunk | null { return null; }
Load(chunk: CKStateChunk, file: CKFile): CKERROR { return CKERROR.NONE; }
PreDelete(): void {}
CheckPreDeletion(): void {}
GetMemoryOccupation(): number { return 0; }
IsObjectUsed(o: CKObject, cid: CK_CLASSID): number { return 0; }
RemapDependencies(context: CKDependenciesContext): CKERROR { return CKERROR.NONE; }
Copy(o: CKObject, context: CKDependenciesContext): CKERROR { return CKERROR.NONE; }
static GetClassName(): CKSTRING { return ""; }
static GetDependenciesCount(mode: number): number { return 0; }
static GetDependencies(i: number, mode: number): CKSTRING { return ""; }
static Register(): void {}
static CreateInstance(context: CKContext): CKParameterOut { return new CKParameterOut(context); }
static ReleaseInstance(iContext: CKContext, instance: CKParameterOut): void {}
static m_ClassID: CK_CLASSID = 0 as CK_CLASSID;
static Cast(iO: CKObject): CKParameterOut | null {
return CKIsChildClassOf(iO, CKCID_PARAMETEROUT) ? (iO as CKParameterOut) : null;
}
Update(): void {}
protected m_Destinations: XSObjectPointerArray = new XSObjectPointerArray();
}

View File

@ -0,0 +1,318 @@
/*************************************************************************/
/* File : CKPluginManager.h */
/* Author : Aymeric Bard */
/* */
/* Virtools SDK */
/* Copyright (c) Virtools 2000, All Rights Reserved. */
/*************************************************************************/
#ifndef CKPLUGINMANAGER_H
#define CKPLUGINMANAGER_H "$Id:$"
#define CKPLUGIN_BITMAP "Bitmap Readers"
#define CKPLUGIN_SOUND "Sound Readers"
#define CKPLUGIN_MODEL "Model Readers"
#define CKPLUGIN_MANAGER "Managers"
#define CKPLUGIN_BEHAVIOR "BuildingBlocks"
#define CKPLUGIN_RENDERENGINE "Render Engines"
#define CKPLUGIN_MOVIE "Movie Readers"
#define CKPLUGIN_EXTENSIONS "Extensions"
#ifdef CK_LIB
/*******************************************
+ There is only one function a rasterizer Dll is supposed
to export :"CKRasterizerGetInfo", it will be used by the render engine
to retrieve information about the plugin :
{secret}
******************************************/
struct CKRasterizerInfo;
typedef void (*CKRST_GETINFO)(CKRasterizerInfo*);
#endif
/********************************************************
Summary: Short description of a DLL that declared plugins
Remarks:
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
struct CKPluginDll
{
XString m_DllFileName;
INSTANCE_HANDLE m_DllInstance;
int m_PluginInfoCount;
};
{html:</td></tr></table>}
See Also: CKPluginManager::GetPluginDllInfo
*************************************************************/
struct CKPluginDll
{
XString m_DllFileName; // DLL Path
INSTANCE_HANDLE m_DllInstance; // Instance of the Loaded Dll (as HINSTANCE on windows)
int m_PluginInfoCount; // Number of plugins declared by this DLL
CKPluginDll() {
m_DllFileName = "";
m_DllInstance=0;
}
//Summary: Returns a pointer to a function inside the plugin.
//Arguments:
// FunctionName: Name of the function which should be returned
//Return Value:
// A Pointer to the function or NULL if the function was not found in the DLL.
void* GetFunctionPtr(CKSTRING FunctionName) {
VxSharedLibrary shl;
shl.Attach(m_DllInstance);
return shl.GetFunctionPtr(FunctionName);
}
};
// Summary: Reader plugin creation function prototype
//
// See Also:Creating New Plugins
typedef CKDataReader *(*CKReaderGetReaderFunction)(int);
// Summary: Data Reader (Movie,Bitmap,Sound,Models...) specific options
//
struct CKPluginEntryReadersData
{
CKGUID m_SettingsParameterGuid; // Parameter type for options
int m_OptionCount; // Number of options for the reader
CK_DATAREADER_FLAGS m_ReaderFlags; // Reader Save/Load options
CKReaderGetReaderFunction m_GetReaderFct; // A pointer to the function that will create a reader.
CKPluginEntryReadersData() {
m_GetReaderFct = NULL;
m_OptionCount = 0;
m_ReaderFlags = (CK_DATAREADER_FLAGS)0;
m_SettingsParameterGuid = CKGUID(0,0);
}
};
// Summary: List of behavior GUID declared by a plugin
//
//See Also:CKPluginEntry
struct CKPluginEntryBehaviorsData
{
XArray<CKGUID> m_BehaviorsGUID;
};
/******************************************************
Summary: Plugin Description structure
Remarks:
+ This structure described a registred Virtools plugin :
{html:<table width="90%" border="1" align="center" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><tr bgcolor="#E6E6E6" bordercolor="#000000"><td>}
struct CKPluginEntry
{
int m_PluginDllIndex;
int m_PositionInDll;
CKPluginInfo m_PluginInfo;
(According to the type of plugin )
CKPluginEntryReadersData* m_ReadersInfo;
CKPluginEntryBehaviorsData* m_BehaviorsInfo;
CKBOOL m_Active;
int m_IndexInCategory;
CKBOOL m_NeededByFile;
}
{html:</td></tr></table>}
See Also:CKPluginManager::GetPluginInfo
********************************************************/
struct CKPluginEntry
{
int m_PluginDllIndex; // Index of the owner Dll in the list of Dlls
int m_PositionInDll; // Position of the PluginInfo inside the DLL (when thery are several plugins inside a same DLL)
CKPluginInfo m_PluginInfo; // Base Info on the plugin (Type, Name,Description)
//--- According to the type of plugin
CKPluginEntryReadersData* m_ReadersInfo; // Reader plugins specific info (optionnal settings + load/save capabilities)
CKPluginEntryBehaviorsData* m_BehaviorsInfo; // Behavior plugins specific info (list of declared behavior GUIDS)
CKBOOL m_Active; // For manager and Render engines TRUE if a manager was created, for other plugins this value is not used.
int m_IndexInCategory; // Index of this entry in its category
CKBOOL m_NeededByFile; // When saving a file TRUE if at least one object needs this plugin
CKPluginEntry& operator = (const CKPluginEntry& ent);
CKPluginEntry();
CKPluginEntry(const CKPluginEntry& ent);
~CKPluginEntry();
};
struct CKPluginCategory
{
XString m_Name;
XArray<CKPluginEntry*> m_Entries;
CKPluginCategory(){}
CKPluginCategory(const CKPluginCategory& s){
m_Name = s.m_Name;
m_Entries = s.m_Entries;
}
// Operator
CKPluginCategory& operator=(const CKPluginCategory& s){
if (&s != this){
m_Name = s.m_Name;
m_Entries = s.m_Entries;
}
return *this;
}
};
// Summary: Plugin declaration count function prototype
//
// See Also:Creating New Plugins
typedef int (*CKPluginGetInfoCountFunction)();
// Summary: Plugin declaration function prototype
//
// See Also:Creating New Plugins
typedef CKPluginInfo* (*CKPluginGetInfoFunction)(int Index);
/*****************************************************************************
Summary: Plugins Manager
Remarks:
+ CKPluginManager does not derive from CKBaseManager and there is
only one instance of the plugin per process (even if there are several CKContext)
+ PluginManager init functions must be call before creating any CKContext to
find the available plugins (ParsePlugins or RegisterPlugin).
+ The plugin manager can be retrieve with the CKGetPluginManager function.
+ Plugins are sorted by their category, many methods asks to be given a
category which must be a valid CK_PLUGIN_TYPE identifier or -1 to use all categories.
+ Since a Dll can contain several plugins the plugin manager give acces to either
the list of plugin per category (GetPluginCount,GetPluginInfo) or to the list of Dll
that were loaded (GetPluginDllCount,GetPluginDllInfo). A plugin is identified by its
CKPluginEntry which contains its type and other informations along with the index of
the DLL that declared it.
See Also: CKPluginEntry,CKPluginDll,Creating New Plugins
**********************************************************************************/
class CKPluginManager {
public:
CKPluginManager();
virtual ~CKPluginManager();
//----- Parse a directory for plugins and returns the number of valid plugins enumerated
int ParsePlugins(CKSTRING Directory);
//------ Registers a specific plugin Dll
CKERROR RegisterPlugin(CKSTRING str);
CKPluginEntry* FindComponent(CKGUID Component,int catIdx=-1); // Search for behaviors,managers,readers,etc.. to see if they exists
//---- Category Functions
int AddCategory(CKSTRING cat); // Adds a category, category name must be unique
CKERROR RemoveCategory(int catIdx); // Removes a category, category name must be unique
int GetCategoryCount(); // Gets the number of categories
CKSTRING GetCategoryName(int catIdx); // Gets the category name at specified index
int GetCategoryIndex(CKSTRING cat); // Gets the category Index in List
CKERROR RenameCategory(int catIdx, CKSTRING newName); // Renames a category
//---- PluginDll Functions
int GetPluginDllCount(); // Gets the Plugin count
CKPluginDll* GetPluginDllInfo(int PluginDllIdx); // Gets the Plugin at index
CKPluginDll* GetPluginDllInfo(CKSTRING PluginName,int *idx = NULL); // Search for a Plugin by name
CKERROR UnLoadPluginDll(int PluginDllIdx);
CKERROR ReLoadPluginDll(int PluginDllIdx);
//---- Plugin Functions
int GetPluginCount(int catIdx); // Gets the Plugin count for a category
CKPluginEntry* GetPluginInfo(int catIdx, int PluginIdx); // Gets the Plugin at index PluginIdx for a category
//---- Bitmap,Sound,Model or Movie Reader Access
BOOL SetReaderOptionData(CKContext* context,void* memdata,CKParameterOut* Param,CKFileExtension ext,CKGUID* guid=NULL);
CKParameterOut* GetReaderOptionData(CKContext* context,void* memdata,CKFileExtension ext,CKGUID* guid=NULL);
CKBitmapReader* GetBitmapReader(CKFileExtension& ext,CKGUID *preferedGUID = NULL);
CKSoundReader* GetSoundReader(CKFileExtension& ext,CKGUID *preferedGUID = NULL);
CKModelReader* GetModelReader(CKFileExtension& ext,CKGUID *preferedGUID = NULL);
CKMovieReader* GetMovieReader(CKFileExtension& ext,CKGUID *preferedGUID = NULL);
//---- Model and Virtools Loading access {secret}
CKERROR Load(CKContext* context,CKSTRING FileName,CKObjectArray *liste,CK_LOAD_FLAGS LoadFlags,CKCharacter *carac=NULL,CKGUID* Readerguid=NULL); // {secret}
CKERROR Save(CKContext* context,CKSTRING FileName,CKObjectArray *liste,CKDWORD SaveFlags,CKGUID* Readerguid=NULL); // {secret}
//---- Init {secret}
void ReleaseAllPlugins();
void InitializePlugins(CKContext* context);
void DeInitializePlugins(CKContext* context);
void ComputeDependenciesList(CKFile* file);
void MarkComponentAsNeeded(CKGUID Component,int catIdx);
#ifdef CK_LIB
//-------------------------------------------------------------------
#ifdef DOCJETDUMMY // Docjet secret macro
#else
//---------------- for additionnal plugins to link statically
void RegisterPluginInfo(int PositionInDll,CKPluginInfo* info,CKDLL_OBJECTDECLARATIONFUNCTION InfoFct,CKReaderGetReaderFunction GetReaderFunc);
void RegisterNewStaticLibAsDll(char* Name,int PluginInfoCount);
void AddRenderEngineRasterizer(CKRST_GETINFO RasterizerInfoFunction) { m_StaticRasterizers.PushBack(RasterizerInfoFunction); }
const XArray<CKRST_GETINFO>& GetRegistredRasterizers() { return m_StaticRasterizers; }
#endif // Docjet secret macro
#endif
protected:
//--- Utils
void InitInstancePluginEntry(CKPluginEntry* entry,CKContext* context);
void ExitInstancePluginEntry(CKPluginEntry* entry,CKContext* context);
void InitializeBehaviors(VxSharedLibrary& lib,CKPluginEntry& entry);
void InitializeBehaviors(CKDLL_OBJECTDECLARATIONFUNCTION Fct,CKPluginEntry& entry);
void RemoveBehaviors(int PluginIndex);
#ifdef CK_LIB
XArray<CKRST_GETINFO> m_StaticRasterizers;
#endif
int AddPlugin(int catIdx, CKPluginEntry& Plugin); // Adds a Plugin to a category
CKERROR RemovePlugin(int catIdx, int PluginIdx); // Removes a Plugin in a category
CKPluginEntry* EXTFindEntry(CKFileExtension& ext,int Category=-1);
CKDataReader *EXTFindReader(CKFileExtension& ext,int Category=-1);
CKDataReader *GUIDFindReader(CKGUID& guid,int Category=-1);
XClassArray<CKPluginCategory> m_PluginCategories;
XClassArray<CKPluginDll> m_PluginDlls;
XClassArray<VxSharedLibrary*> m_RunTimeDlls;
void Clean();
void Init();
};
#endif

View File

@ -0,0 +1,104 @@
const CKPLUGINMANAGER_H = "$Id:$";
const CKPLUGIN_BITMAP = "Bitmap Readers";
const CKPLUGIN_SOUND = "Sound Readers";
const CKPLUGIN_MODEL = "Model Readers";
const CKPLUGIN_MANAGER = "Managers";
const CKPLUGIN_BEHAVIOR = "BuildingBlocks";
const CKPLUGIN_RENDERENGINE = "Render Engines";
const CKPLUGIN_MOVIE = "Movie Readers";
const CKPLUGIN_EXTENSIONS = "Extensions";
interface CKRasterizerInfo {}
type CKRST_GETINFO = (info: CKRasterizerInfo) => void;
interface CKPluginDll {
m_DllFileName: string;
m_DllInstance: INSTANCE_HANDLE;
m_PluginInfoCount: number;
GetFunctionPtr(FunctionName: CKSTRING): void | null;
}
type CKReaderGetReaderFunction = (type: number) => CKDataReader;
interface CKPluginEntryReadersData {
m_SettingsParameterGuid: CKGUID;
m_OptionCount: number;
m_ReaderFlags: CK_DATAREADER_FLAGS;
m_GetReaderFct: CKReaderGetReaderFunction | null;
}
interface CKPluginEntryBehaviorsData {
m_BehaviorsGUID: Array<CKGUID>;
}
interface CKPluginEntry {
m_PluginDllIndex: number;
m_PositionInDll: number;
m_PluginInfo: CKPluginInfo;
m_ReadersInfo: CKPluginEntryReadersData | null;
m_BehaviorsInfo: CKPluginEntryBehaviorsData | null;
m_Active: CKBOOL;
m_IndexInCategory: number;
m_NeededByFile: CKBOOL;
}
interface CKPluginCategory {
m_Name: string;
m_Entries: Array<CKPluginEntry>;
}
type CKPluginGetInfoCountFunction = () => number;
type CKPluginGetInfoFunction = (Index: number) => CKPluginInfo;
class CKPluginManager {
constructor() {}
ParsePlugins(Directory: CKSTRING): number { return 0; }
RegisterPlugin(str: CKSTRING): CKERROR { return CKERROR.FAILURE; }
FindComponent(Component: CKGUID, catIdx: number = -1): CKPluginEntry | null { return null; }
AddCategory(cat: CKSTRING): number { return 0; }
RemoveCategory(catIdx: number): CKERROR { return CKERROR.FAILURE; }
GetCategoryCount(): number { return 0; }
GetCategoryName(catIdx: number): CKSTRING { return ""; }
GetCategoryIndex(cat: CKSTRING): number { return 0; }
RenameCategory(catIdx: number, newName: CKSTRING): CKERROR { return CKERROR.FAILURE; }
GetPluginDllCount(): number { return 0; }
GetPluginDllInfo(PluginDllIdx: number): CKPluginDll | null { return null; }
GetPluginDllInfo(PluginName: CKSTRING, idx?: number): CKPluginDll | null { return null; }
UnLoadPluginDll(PluginDllIdx: number): CKERROR { return CKERROR.FAILURE; }
ReLoadPluginDll(PluginDllIdx: number): CKERROR { return CKERROR.FAILURE; }
GetPluginCount(catIdx: number): number { return 0; }
GetPluginInfo(catIdx: number, PluginIdx: number): CKPluginEntry | null { return null; }
SetReaderOptionData(context: CKContext, memdata: any, Param: CKParameterOut, ext: CKFileExtension, guid?: CKGUID): boolean { return false; }
GetReaderOptionData(context: CKContext, memdata: any, ext: CKFileExtension, guid?: CKGUID): CKParameterOut | null { return null; }
GetBitmapReader(ext: CKFileExtension, preferedGUID?: CKGUID): CKBitmapReader | null { return null; }
GetSoundReader(ext: CKFileExtension, preferedGUID?: CKGUID): CKSoundReader | null { return null; }
GetModelReader(ext: CKFileExtension, preferedGUID?: CKGUID): CKModelReader | null { return null; }
GetMovieReader(ext: CKFileExtension, preferedGUID?: CKGUID): CKMovieReader | null { return null; }
Load(context: CKContext, FileName: CKSTRING, liste: CKObjectArray, LoadFlags: CK_LOAD_FLAGS, carac?: CKCharacter, Readerguid?: CKGUID): CKERROR { return CKERROR.FAILURE; }
Save(context: CKContext, FileName: CKSTRING, liste: CKObjectArray, SaveFlags: CKDWORD, Readerguid?: CKGUID): CKERROR { return CKERROR.FAILURE; }
ReleaseAllPlugins(): void {}
InitializePlugins(context: CKContext): void {}
DeInitializePlugins(context: CKContext): void {}
ComputeDependenciesList(file: CKFile): void {}
MarkComponentAsNeeded(Component: CKGUID, catIdx: number): void {}
AddPlugin(catIdx: number, Plugin: CKPluginEntry): number { return 0; }
RemovePlugin(catIdx: number, PluginIdx: number): CKERROR { return CKERROR.FAILURE; }
EXTFindEntry(ext: CKFileExtension, Category: number = -1): CKPluginEntry | null { return null; }
EXTFindReader(ext: CKFileExtension, Category: number = -1): CKDataReader | null { return null; }
GUIDFindReader(guid: CKGUID, Category: number = -1): CKDataReader | null { return null; }
Clean(): void {}
Init(): void {}
}

View File

@ -0,0 +1,5 @@
Convert to Typescript
- extract & export all types and interfaces
- avoid classes whenever possible
- max. arguments = 2, use options object instead

View File

@ -0,0 +1 @@
kbotd "convert to Typescript, no comments,... just code" --each="*.h" --dst='./${SRC_NAME}.ts' --filters=code --mode=completion --router=openai --model=gpt-4o