UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_model.cpp
Go to the documentation of this file.
1
9
10/*
11Copyright (C) 2002-2025 UFO: Alien Invasion.
12
13This program is free software; you can redistribute it and/or
14modify it under the terms of the GNU General Public License
15as published by the Free Software Foundation; either version 2
16of the License, or (at your option) any later version.
17
18This program is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
22See the GNU General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; if not, write to the Free Software
26Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28*/
29
30#include "../ui_main.h"
31#include "../ui_internal.h"
32#include "../ui_nodes.h"
33#include "../ui_parse.h"
34#include "../ui_input.h"
35#include "../ui_render.h"
36#include "../ui_internal.h"
37#include "ui_node_model.h"
39
40#include "../../client.h"
45
47
48#define EXTRADATA_TYPE modelExtraData_t
49#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
50
51#define ROTATE_SPEED 0.5
52#define MAX_OLDREFVALUE MAX_VAR
53
55
61uiModel_t* UI_GetUIModel (const char* modelName)
62{
63 for (int i = 0; i < ui_global.numModels; i++) {
64 uiModel_t* m = &ui_global.models[i];
65 if (Q_streq(m->id, modelName))
66 return m;
67 }
68 return nullptr;
69}
70
71static void UI_ListUIModels_f (void)
72{
73 /* search for UI models with same name */
74 Com_Printf("UI models: %i\n", ui_global.numModels);
75 for (int i = 0; i < ui_global.numModels; i++) {
76 const uiModel_t* m = &ui_global.models[i];
77 const char* need = m->next != nullptr ? m->next->id : "none";
78 Com_Printf("id: %s\n...model: %s\n...need: %s\n\n", m->id, m->model, need);
79 }
80}
81
82void UI_Model_SetModelSource (uiNode_t* node, const char* modelName) {
83 UI_FreeStringProperty(const_cast<char*>(UI_EXTRADATA(node, modelExtraData_t).model));
85}
86
87void UI_Model_SetSkinSource (uiNode_t* node, const char* skinName) {
88 UI_FreeStringProperty(const_cast<char*>(UI_EXTRADATA(node, modelExtraData_t).skin));
90}
91
92void UI_Model_SetAnimationSource (uiNode_t* node, const char* animName) {
93 UI_FreeStringProperty(const_cast<char*>(UI_EXTRADATA(node, modelExtraData_t).animation));
94 UI_EXTRADATA(node, modelExtraData_t).animation = Mem_PoolStrDup(animName, ui_dynStringPool, 0);
95}
96
97void UI_Model_SetTagSource (uiNode_t* node, const char* tagName) {
98 UI_FreeStringProperty(const_cast<char*>(UI_EXTRADATA(node, modelExtraData_t).tag));
100}
101
104 /* a tag without but not a submodel */
105 if (EXTRADATA(node).tag != nullptr && node->behaviour != node->parent->behaviour) {
106 Com_Printf("UI_ModelNodeLoaded: '%s' use a tag but is not a submodel. Tag removed.\n", UI_GetPath(node));
107 EXTRADATA(node).tag = nullptr;
108 }
109
110 if (EXTRADATA(node).oldRefValue == nullptr)
111 EXTRADATA(node).oldRefValue = UI_AllocStaticString("", MAX_OLDREFVALUE);
112
113 /* no tag but no size */
114 if (EXTRADATA(node).tag == nullptr && (node->box.size[0] == 0 || node->box.size[1] == 0)) {
115 Com_Printf("UI_ModelNodeLoaded: Please set a pos and size to the node '%s'. Note: 'origin' is a relative value to the center of the node\n", UI_GetPath(node));
116 }
117}
118
120{
121 const char* ref = UI_GetReferenceString(node, EXTRADATA(node).model);
122 char source[MAX_VAR];
123 if (Q_strnull(ref))
124 source[0] = '\0';
125 else
126 Q_strncpyz(source, ref, sizeof(source));
127 UI_DrawModelNode(node, source);
128}
129
130static vec3_t nullVector = {0, 0, 0};
131
136static inline void UI_InitModelInfoView (uiNode_t* node, modelInfo_t* mi, uiModel_t* model)
137{
138 vec3_t nodeorigin;
139 UI_GetNodeAbsPos(node, nodeorigin);
140 nodeorigin[0] += node->box.size[0] / 2 + EXTRADATA(node).origin[0];
141 nodeorigin[1] += node->box.size[1] / 2 + EXTRADATA(node).origin[1];
142 nodeorigin[2] = EXTRADATA(node).origin[2];
143
144 VectorCopy(EXTRADATA(node).scale, mi->scale);
145 VectorCopy(EXTRADATA(node).angles, mi->angles);
146 VectorCopy(nodeorigin, mi->origin);
147
149}
150
154static void UI_DrawModelNodeWithUIModel (uiNode_t* node, const char* source, modelInfo_t* mi, uiModel_t* model)
155{
156 bool autoScaleComputed = false;
157 vec3_t autoScale;
158 vec3_t autoCenter;
159
160 while (model) {
161 /* no animation */
162 mi->frame = 0;
163 mi->oldframe = 0;
164 mi->backlerp = 0;
165
166 assert(model->model);
167 mi->model = R_FindModel(model->model);
168 if (!mi->model) {
169 model = model->next;
170 continue;
171 }
172
173 mi->skin = model->skin;
174 mi->name = model->model;
175
176 /* set mi pointers to model */
177 mi->origin = model->origin;
178 mi->angles = model->angles;
179 mi->center = model->center;
180 mi->color = model->color;
181 mi->scale = model->scale;
182
183 if (model->tag && model->parent) {
184 /* tag and parent defined */
185 uiModel_t* parentModel;
186 modelInfo_t pmi;
187 vec3_t pmiorigin;
188 animState_t* as;
189 /* place this model part on an already existing model tag */
190 parentModel = UI_GetUIModel(model->parent);
191 if (!parentModel) {
192 Com_Printf("UI Model: Could not get the model '%s'\n", model->parent);
193 break;
194 }
195 pmi.model = R_FindModel(parentModel->model);
196 if (!pmi.model) {
197 Com_Printf("UI Model: Could not get the model '%s'\n", parentModel->model);
198 break;
199 }
200
201 pmi.name = parentModel->model;
202
203 pmi.origin = pmiorigin;
204 pmi.angles = parentModel->angles;
205 pmi.scale = parentModel->scale;
206 pmi.center = parentModel->center;
207 pmi.color = parentModel->color;
208
209 pmi.origin[0] = parentModel->origin[0] + mi->origin[0];
210 pmi.origin[1] = parentModel->origin[1] + mi->origin[1];
211 pmi.origin[2] = parentModel->origin[2];
212 /* don't count window offset twice for tagged models */
213 mi->origin[0] -= node->root->box.pos[0];
214 mi->origin[1] -= node->root->box.pos[1];
215
216 /* autoscale? */
217 if (EXTRADATA(node).autoscale) {
218 if (!autoScaleComputed)
219 Sys_Error("Wrong order of model nodes - the tag and parent model node must be after the base model node");
220 pmi.scale = autoScale;
221 pmi.center = autoCenter;
222 }
223
224 as = &parentModel->animState;
225 pmi.frame = as->frame;
226 pmi.oldframe = as->oldframe;
227 pmi.backlerp = as->backlerp;
228
229 R_DrawModelDirect(mi, &pmi, model->tag);
230 } else {
231 /* no tag and no parent means - base model or single model */
232 const char* ref;
233 UI_InitModelInfoView(node, mi, model);
234 Vector4Copy(node->color, mi->color);
235
236 /* compute the scale and center for the first model.
237 * it think its the bigger of composite models.
238 * All next elements use the same result
239 */
240 if (EXTRADATA(node).autoscale) {
241 if (!autoScaleComputed) {
242 vec2_t size;
243 size[0] = node->box.size[0] - node->padding;
244 size[1] = node->box.size[1] - node->padding;
245 R_ModelAutoScale(size, mi, autoScale, autoCenter);
246 autoScaleComputed = true;
247 } else {
248 mi->scale = autoScale;
249 mi->center = autoCenter;
250 }
251 }
252
253 /* get the animation given by node properties */
254 if (EXTRADATA(node).animation && *EXTRADATA(node).animation) {
255 ref = UI_GetReferenceString(node, EXTRADATA(node).animation);
256 /* otherwise use the standard animation from UI model definition */
257 } else
258 ref = model->anim;
259
260 /* only base models have animations */
261 if (ref && *ref) {
262 animState_t* as = &model->animState;
263 const char* anim = R_AnimGetName(as, mi->model);
264 /* initial animation or animation change */
265 if (anim == nullptr || !Q_streq(anim, ref))
266 R_AnimChange(as, mi->model, ref);
267 else
268 R_AnimRun(as, mi->model, cls.frametime * 1000);
269
270 mi->frame = as->frame;
271 mi->oldframe = as->oldframe;
272 mi->backlerp = as->backlerp;
273 }
274 R_DrawModelDirect(mi, nullptr, nullptr);
275 }
276
277 /* next */
278 model = model->next;
279 }
280}
281
285void UI_DrawModelNode (uiNode_t* node, const char* source)
286{
287 modelInfo_t mi;
288 uiModel_t* model;
289 vec3_t nodeorigin;
290 vec2_t screenPos;
291
292 assert(UI_NodeInstanceOf(node, "model"));
293
294 if (!source || source[0] == '\0')
295 return;
296
297 model = UI_GetUIModel(source);
298 /* direct model name - no UI model definition */
299 if (!model) {
300 /* prevent the searching for a model def in the next frame */
301 mi.model = R_FindModel(source);
302 mi.name = source;
303 if (!mi.model) {
304 Com_Printf("Could not find model '%s'\n", source);
305 return;
306 }
307 }
308
309 /* compute the absolute origin ('origin' property is relative to the node center) */
310 UI_GetNodeScreenPos(node, screenPos);
311 UI_GetNodeAbsPos(node, nodeorigin);
312 R_CleanupDepthBuffer(nodeorigin[0], nodeorigin[1], node->box.size[0], node->box.size[1]);
313 if (EXTRADATA(node).clipOverflow) {
314 UI_PushClipRect(screenPos[0], screenPos[1], node->box.size[0], node->box.size[1]);
315 }
316 nodeorigin[0] += node->box.size[0] / 2 + EXTRADATA(node).origin[0];
317 nodeorigin[1] += node->box.size[1] / 2 + EXTRADATA(node).origin[1];
318 nodeorigin[2] = EXTRADATA(node).origin[2];
319
320 VectorMA(EXTRADATA(node).angles, cls.frametime, EXTRADATA(node).omega, EXTRADATA(node).angles);
321 mi.origin = nodeorigin;
322 mi.angles = EXTRADATA(node).angles;
323 mi.scale = EXTRADATA(node).scale;
324 mi.center = nullVector;
325 mi.color = node->color;
326 mi.mesh = 0;
327
328 /* special case to draw models with UI model */
329 if (model) {
330 UI_DrawModelNodeWithUIModel(node, source, &mi, model);
331 if (EXTRADATA(node).clipOverflow)
333 return;
334 }
335
336 /* if the node is linked to a parent, the parent will display it */
337 if (EXTRADATA(node).tag) {
338 if (EXTRADATA(node).clipOverflow)
340 return;
341 }
342
343 /* autoscale? */
344 if (EXTRADATA(node).autoscale) {
345 vec3_t autoScale;
346 vec3_t autoCenter;
347 const vec2_t size = {node->box.size[0] - node->padding, node->box.size[1] - node->padding};
348 R_ModelAutoScale(size, &mi, autoScale, autoCenter);
349 }
350
351 /* no animation */
352 mi.frame = 0;
353 mi.oldframe = 0;
354 mi.backlerp = 0;
355
356 /* get skin */
357 if (EXTRADATA(node).skin && *EXTRADATA(node).skin)
358 mi.skin = atoi(UI_GetReferenceString(node, EXTRADATA(node).skin));
359 else
360 mi.skin = 0;
361
362 /* do animations */
363 if (EXTRADATA(node).animation && *EXTRADATA(node).animation) {
364 const char* ref;
365 ref = UI_GetReferenceString(node, EXTRADATA(node).animation);
366
367 /* check whether the cvar value changed */
368 if (strncmp(EXTRADATA(node).oldRefValue, source, MAX_OLDREFVALUE)) {
369 Q_strncpyz(EXTRADATA(node).oldRefValue, source, MAX_OLDREFVALUE);
370 /* model has changed but mem is already reserved in pool */
371 Mem_Free(EXTRADATA(node).animationState);
372 EXTRADATA(node).animationState = nullptr;
373 }
374 animState_t* as = EXTRADATA(node).animationState;
375 if (!as) {
377 if (!as)
378 Com_Error(ERR_DROP, "Model %s should have animState_t for animation %s - but doesn't\n", mi.name, ref);
379 R_AnimChange(as, mi.model, ref);
380 EXTRADATA(node).animationState = as;
381 } else {
382 const char* anim;
383 /* change anim if needed */
384 anim = R_AnimGetName(as, mi.model);
385 if (anim && !Q_streq(anim, ref))
386 R_AnimChange(as, mi.model, ref);
387 R_AnimRun(as, mi.model, cls.frametime * 1000);
388 }
389
390 mi.frame = as->frame;
391 mi.oldframe = as->oldframe;
392 mi.backlerp = as->backlerp;
393 }
394
395 /* draw the main model on the node */
396 R_DrawModelDirect(&mi, nullptr, nullptr);
397
398 /* draw all children */
399 if (node->firstChild) {
400 modelInfo_t pmi = mi;
401 for (uiNode_t* child = node->firstChild; child; child = child->next) {
402 const char* tag;
403 char childSource[MAX_VAR];
404 const char* childRef;
405
406 /* skip non "model" nodes */
407 if (child->behaviour != node->behaviour)
408 continue;
409
410 /* skip invisible child */
411 if (child->invis || !UI_CheckVisibility(child))
412 continue;
413
414 OBJZERO(mi);
415 mi.angles = EXTRADATA(child).angles;
416 mi.scale = EXTRADATA(child).scale;
417 mi.center = nullVector;
418 mi.origin = EXTRADATA(child).origin;
419 mi.color = pmi.color;
420
421 /* get the anchor name to link the model into the parent */
422 tag = EXTRADATA(child).tag;
423
424 /* init model name */
425 childRef = UI_GetReferenceString(child, EXTRADATA(child).model);
426 if (Q_strnull(childRef))
427 childSource[0] = '\0';
428 else
429 Q_strncpyz(childSource, childRef, sizeof(childSource));
430 mi.model = R_FindModel(childSource);
431 mi.name = childSource;
432
433 /* init skin */
434 if (EXTRADATA(child).skin && *EXTRADATA(child).skin)
435 mi.skin = atoi(UI_GetReferenceString(child, EXTRADATA(child).skin));
436 else
437 mi.skin = 0;
438
439 R_DrawModelDirect(&mi, &pmi, tag);
440 }
441 }
442
443 if (EXTRADATA(node).clipOverflow)
445}
446
447static int oldMousePosX = 0;
448static int oldMousePosY = 0;
449
451{
452 float* rotateAngles = EXTRADATA(node).angles;
453
454 /* rotate a model */
455 rotateAngles[YAW] -= ROTATE_SPEED * (x - oldMousePosX);
456 rotateAngles[ROLL] += ROTATE_SPEED * (y - oldMousePosY);
457
458 /* clamp the angles */
459 rotateAngles[YAW] -= floor(rotateAngles[YAW] / 360.0) * 360.0;
460
461 if (rotateAngles[ROLL] < 0.0)
462 rotateAngles[ROLL] = 0.0;
463 else if (rotateAngles[ROLL] > 180.0)
464 rotateAngles[ROLL] = 180.0;
465
466 oldMousePosX = x;
467 oldMousePosY = y;
468}
469
470void uiModelNode::onMouseDown (uiNode_t* node, int x, int y, int button)
471{
472 if (button != K_MOUSE1)
473 return;
474 if (!EXTRADATA(node).rotateWithMouse)
475 return;
476 UI_SetMouseCapture(node);
477 oldMousePosX = x;
478 oldMousePosY = y;
479}
480
481void uiModelNode::onMouseUp (uiNode_t* node, int x, int y, int button)
482{
483 if (button != K_MOUSE1)
484 return;
485 if (UI_GetMouseCapture() != node)
486 return;
488}
489
494{
495 Vector4Set(node->color, 1, 1, 1, 1);
496 VectorSet(EXTRADATA(node).scale, 1, 1, 1);
497 EXTRADATA(node).clipOverflow = true;
498}
499
504{
506 if (!clone->dynamic)
508}
509
511{
512 EXTRADATA(node).oldRefValue = Mem_PoolAllocTypeN(char, MAX_OLDREFVALUE, ui_dynPool);
513 EXTRADATA(node).oldRefValue[0] = '\0';
514}
515
517{
518 uiNode::deleteNode(node);
519 Mem_Free(EXTRADATA(node).oldRefValue);
520 EXTRADATA(node).oldRefValue = nullptr;
521}
522
524{
525 /* checks moved to doLayout */
526}
527
529{
530 localBehaviour = behaviour;
531 behaviour->name = "model";
532 behaviour->drawItselfChild = true;
533 behaviour->manager = UINodePtr(new uiModelNode());
534 behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
535 behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiModelNode_t *");
536
537 /* Both. Name of the animation for the model */
539 /* Main model only. Point of view. */
540 UI_RegisterExtradataNodeProperty(behaviour, "angles", V_VECTOR, modelExtraData_t, angles);
541 /* Main model only. Position of the model relative to the center of the node. */
543 /* Main model only. Rotation vector of the model. */
545 /* Both. Scale the model */
547 /* Submodel only. A tag name to link the model to the parent model. */
549 /* Main model only. Auto compute the "better" scale for the model. The function dont work
550 * very well at the moment because it dont check the angle and no more submodel bounding box.
551 */
552 UI_RegisterExtradataNodeProperty(behaviour, "autoscale", V_BOOL, modelExtraData_t, autoscale);
553 /* Main model only. Allow to change the POV of the model with the mouse (only for main model) */
554 UI_RegisterExtradataNodeProperty(behaviour, "rotatewithmouse", V_BOOL, modelExtraData_t, rotateWithMouse);
555 /* Main model only. Clip the model with the node rect */
556 UI_RegisterExtradataNodeProperty(behaviour, "clipoverflow", V_BOOL, modelExtraData_t, clipOverflow);
557 /* Source of the model. The path to the model, relative to <code>base/models</code> */
559 /* Both. Name of the skin for the model. */
561
562 Cmd_AddCommand("uimodelslist", UI_ListUIModels_f);
563}
static int oldMousePosX
Definition cl_input.cpp:77
static int oldMousePosY
Definition cl_input.cpp:77
@ K_MOUSE1
Definition cl_keys.h:46
client_static_t cls
Definition cl_main.cpp:83
memPool_t * cl_genericPool
Definition cl_main.cpp:86
virtual void doLayout(uiNode_t *node)
Call to update the node layout. This common code revalidates the node tree.
void onLoading(uiNode_t *node) override
Called before loading. Used to set default attribute values.
void deleteNode(uiNode_t *node) override
void initNodeDynamic(uiNode_t *node) override
void onMouseDown(uiNode_t *node, int x, int y, int button) override
void onLoaded(uiNode_t *node) override
void draw(uiNode_t *node) override
void clone(uiNode_t const *source, uiNode_t *clone) override
Call to update a cloned node.
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
void onMouseUp(uiNode_t *node, int x, int y, int button) override
void doLayout(uiNode_t *node) override
Call to update the node layout. This common code revalidates the node tree.
virtual void deleteNode(uiNode_t *node)
virtual void clone(uiNode_t const *source, uiNode_t *clone)
Primary header for client.
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
Definition cmd.cpp:744
void Com_Error(int code, const char *fmt,...)
Definition common.cpp:459
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
#define ERR_DROP
Definition common.h:211
void Sys_Error(const char *error,...)
Definition g_main.cpp:421
voidpf void uLong size
Definition ioapi.h:42
voidpf uLong int origin
Definition ioapi.h:45
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb).
Definition mathlib.cpp:261
#define YAW
Definition mathlib.h:55
#define ROLL
Definition mathlib.h:56
static struct mdfour * m
Definition md4.cpp:35
#define Mem_PoolAllocTypeN(type, n, pool)
Definition mem.h:42
#define Mem_Free(ptr)
Definition mem.h:35
#define Mem_PoolStrDup(in, pool, tagNum)
Definition mem.h:50
#define Mem_PoolAllocType(type, pool)
Definition mem.h:43
void R_CleanupDepthBuffer(int x, int y, int width, int height)
"Clean up" the depth buffer into a rect
Definition r_draw.cpp:596
QGL_EXTERN GLint i
Definition r_gl.h:113
void R_DrawModelDirect(modelInfo_t *mi, modelInfo_t *pmi, const char *tagname)
Draws a model in 2d mode (for rendering model data from the ui).
Definition r_mesh.cpp:306
void R_ModelAutoScale(const vec2_t boxSize, modelInfo_t *mi, vec3_t scale, vec3_t center)
Compute scale and center for a model info data structure.
Definition r_mesh.cpp:278
void R_AnimRun(animState_t *as, const model_t *mod, int msec)
Run the animation of the given model.
void R_AnimChange(animState_t *as, const model_t *mod, const char *name)
Changes the animation for md2 models.
const char * R_AnimGetName(const animState_t *as, const model_t *mod)
Get the current running animation for a model.
model_t * R_FindModel(const char *name)
Tries to load a model.
Definition r_model.cpp:203
Brush model header file.
@ V_BOOL
Definition scripts.h:50
@ V_VECTOR
Definition scripts.h:56
Header for lua script functions.
#define Q_streq(a, b)
Definition shared.h:136
bool Q_strnull(const char *string)
Definition shared.h:138
#define OBJZERO(obj)
Definition shared.h:178
#define MAX_VAR
Definition shared.h:36
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
Definition shared.cpp:457
float backlerp
Definition r_entity.h:57
int oldframe
Definition r_entity.h:56
extradata for the model node
float * origin
Definition cl_renderer.h:61
float * center
Definition cl_renderer.h:64
float * angles
Definition cl_renderer.h:62
float backlerp
Definition cl_renderer.h:67
const char * name
Definition cl_renderer.h:59
float * color
Definition cl_renderer.h:71
model_t * model
Definition cl_renderer.h:58
float * scale
Definition cl_renderer.h:63
node behaviour, how a node work
const char * name
void * lua_SWIG_typeinfo
UINodePtr manager
intptr_t extraDataSize
vec2_t size
Definition ui_nodes.h:52
vec2_t pos
Definition ui_nodes.h:51
Model that have more than one part (top and down part of an aircraft).
char * parent
struct uiModel_s * next
vec3_t center
char * anim
vec3_t angles
animState_t animState
vec3_t scale
char * model
vec3_t origin
vec4_t color
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
uiNode_t * firstChild
Definition ui_nodes.h:89
uiNode_t * next
Definition ui_nodes.h:91
vec4_t color
Definition ui_nodes.h:127
uiBehaviour_t * behaviour
Definition ui_nodes.h:83
uiNode_t * parent
Definition ui_nodes.h:92
uiBox_t box
Definition ui_nodes.h:96
int padding
Definition ui_nodes.h:109
uiNode_t * root
Definition ui_nodes.h:93
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec2_t[2]
Definition ufotypes.h:38
void UI_FreeStringProperty(void *pointer)
Free a string property if it is allocated into ui_dynStringPool.
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
void UI_SetMouseCapture(uiNode_t *node)
Captured the mouse into a node.
Definition ui_input.cpp:516
uiNode_t * UI_GetMouseCapture(void)
Return the captured node.
Definition ui_input.cpp:508
void UI_MouseRelease(void)
Release the captured node.
Definition ui_input.cpp:526
Internal data use by the UI package.
memPool_t * ui_dynPool
Definition ui_main.cpp:41
uiGlobal_t ui_global
Definition ui_main.cpp:38
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
bool UI_NodeInstanceOf(const uiNode_t *node, const char *behaviourName)
Check the node inheritance.
Definition ui_node.cpp:453
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
Definition ui_node.cpp:526
void UI_GetNodeScreenPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node in the screen. Screen position is not used for the node rende...
Definition ui_node.cpp:554
SharedPtr< uiNode > UINodePtr
#define EXTRADATA_TYPE
#define EXTRADATA(node)
static const vec3_t scale
static vec3_t nullVector
void UI_Model_SetTagSource(uiNode_t *node, const char *tagName)
void UI_Model_SetAnimationSource(uiNode_t *node, const char *animName)
uiModel_t * UI_GetUIModel(const char *modelName)
Returns pointer to UI model.
void UI_DrawModelNode(uiNode_t *node, const char *source)
#define EXTRADATA(node)
static void UI_DrawModelNodeWithUIModel(uiNode_t *node, const char *source, modelInfo_t *mi, uiModel_t *model)
Draw a model using UI model definition.
void UI_RegisterModelNode(uiBehaviour_t *behaviour)
#define ROTATE_SPEED
static void UI_InitModelInfoView(uiNode_t *node, modelInfo_t *mi, uiModel_t *model)
Set the Model info view (angle, origin, scale) according to the node definition.
void UI_Model_SetModelSource(uiNode_t *node, const char *modelName)
#define MAX_OLDREFVALUE
static const uiBehaviour_t * localBehaviour
static void UI_ListUIModels_f(void)
void UI_Model_SetSkinSource(uiNode_t *node, const char *skinName)
void UI_DrawModelNode(uiNode_t *node, const char *source)
memPool_t * ui_dynStringPool
Definition ui_main.cpp:40
bool UI_CheckVisibility(uiNode_t *node)
Check the if conditions for a given node.
Definition ui_nodes.cpp:152
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
Definition ui_nodes.cpp:174
#define UI_EXTRADATA(NODE, TYPE)
Definition ui_nodes.h:185
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
char * UI_AllocStaticString(const char *string, int size)
Allocate a string into the UI static memory.
Definition ui_parse.cpp:204
#define V_CVAR_OR_STRING
Definition ui_parse.h:69
void UI_PushClipRect(int x, int y, int width, int height)
Definition ui_render.cpp:47
void UI_PopClipRect(void)
Definition ui_render.cpp:52
#define Vector4Set(v, r, g, b, a)
Definition vector.h:62
#define Vector4Copy(src, dest)
Definition vector.h:53
#define VectorCopy(src, dest)
Definition vector.h:51
#define VectorSet(v, x, y, z)
Definition vector.h:59