Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Khanat code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tycho Brahe
Khanat code
Commits
57057b77
Commit
57057b77
authored
Jan 10, 2017
by
ulukyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: Scenographic Editor crash the client
parent
6344d0e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
52 deletions
+158
-52
code/ryzom/client/src/actions.h
code/ryzom/client/src/actions.h
+5
-5
code/ryzom/client/src/cursor_functions.cpp
code/ryzom/client/src/cursor_functions.cpp
+30
-41
code/ryzom/client/src/entities.cpp
code/ryzom/client/src/entities.cpp
+121
-6
code/ryzom/client/src/entities.h
code/ryzom/client/src/entities.h
+2
-0
No files found.
code/ryzom/client/src/actions.h
View file @
57057b77
...
...
@@ -281,16 +281,16 @@ public:
// HashMapTraits for NLMISC::TKey
struct
CTKeyHashMapTraits
{
enum
{
bucket_size
=
4
,
min_buckets
=
8
,
};
CTKeyHashMapTraits
()
{
}
//
enum { bucket_size = 4, min_buckets = 8, };
//
CTKeyHashMapTraits() { }
size_t
operator
()
(
NLMISC
::
TKey
key
)
const
{
return
(
size_t
)
key
;
return
static_cast
<
std
::
size_t
>
(
key
)
;
}
bool
operator
()
(
NLMISC
::
TKey
key1
,
NLMISC
::
TKey
key2
)
const
/*
bool operator() (NLMISC::TKey key1, NLMISC::TKey key2) const
{
return key1 < key2;
}
}
*/
};
/**
...
...
code/ryzom/client/src/cursor_functions.cpp
View file @
57057b77
...
...
@@ -60,8 +60,7 @@ CLFECOMMON::TCLEntityId SlotUnderCursor;
uint32
MissionId
=
0
;
uint32
MissionRingId
=
0
;
sint32
InstanceId
=
0
;
UInstance
selectedInstance
;
const
UInstance
noSelectedInstance
;
sint32
selectedInstance
=
-
1
;
string
selectedInstanceURL
;
static
NLMISC
::
CRefPtr
<
NLMISC
::
CCDBNodeLeaf
>
s_UserCharFade
;
...
...
@@ -129,7 +128,7 @@ void initContextualCursor()
ContextCur
.
add
(
true
,
"MISSION"
,
string
(
""
),
0.0
f
,
checkUnderCursor
,
contextMission
);
ContextCur
.
add
(
true
,
"WEB PAGE"
,
string
(
""
),
0.0
f
,
checkUnderCursor
,
contextWebPage
);
ContextCur
.
add
(
true
,
"WEBIG"
,
string
(
""
),
0.0
f
,
checkUnderCursor
,
contextWebIG
);
ContextCur
.
add
(
false
,
"ARKITECT"
,
string
(
"curs_
pick.tga"
),
0.0
f
,
checkUnderCursor
,
contextARKitect
);
ContextCur
.
add
(
false
,
"ARKITECT"
,
string
(
"curs_
create.tga"
),
0.0
f
,
checkUnderCursor
,
contextARKitect
);
ContextCur
.
add
(
true
,
"OUTPOST"
,
string
(
""
),
0.0
f
,
checkUnderCursor
,
contextOutpost
);
ContextCur
.
add
(
true
,
"RING MISSION"
,
string
(
""
),
0.0
f
,
checkUnderCursor
,
contextRingMission
);
ContextCur
.
add
(
true
,
"BUILD_TOTEM"
,
string
(
"uimGcmChooseBuilding"
),
0.0
f
,
checkUnderCursor
,
contextBuildTotem
);
...
...
@@ -346,7 +345,6 @@ void checkUnderCursor()
// Entity Under the cursor is the entity selected.
else
{
// Wait for the target is up to date. Do not display context cursor if the user is mounted.
if
(
(
UserEntity
->
selection
()
==
UserEntity
->
targetSlot
())
&&
(
!
UserEntity
->
isRiding
())
)
...
...
@@ -536,59 +534,49 @@ void checkUnderCursor()
sint32
instance_idx
;
CShapeInstanceReference
instref
=
EntitiesMngr
.
getShapeInstanceUnderPos
(
cursX
,
cursY
,
instance_idx
);
if
(
EntitiesMngr
.
instancesRemoved
())
selectedInstance
=
noSelectedInstance
;
std
::
vector
<
string
>
keys
;
keys
.
push_back
(
"colorize"
);
if
(
instance_idx
!=
selectedInstance
&&
selectedInstance
!=
-
1
)
{
std
::
vector
<
string
>
values
;
values
.
push_back
(
"0"
);
EntitiesMngr
.
setupInstance
((
uint32
)
selectedInstance
,
keys
,
values
);
}
UInstance
instance
=
instref
.
Instance
;
if
(
!
instance
.
empty
())
if
(
!
instance
.
empty
()
&&
!
instref
.
ContextURL
.
empty
()
)
{
if
(
instance
.
getObjectPtr
()
!=
selectedInstance
.
getObjectPtr
())
{
for
(
uint
j
=
0
;
j
<
selectedInstance
.
getNumMaterials
();
j
++
)
{
// unhighlight
selectedInstance
.
getMaterial
(
j
).
setEmissive
(
CRGBA
(
255
,
255
,
255
,
255
));
selectedInstance
.
getMaterial
(
j
).
setShininess
(
10.0
f
);
}
selectedInstance
=
instance
;
// For all materials
for
(
uint
j
=
0
;
j
<
selectedInstance
.
getNumMaterials
();
j
++
)
{
// highlight
selectedInstance
.
getMaterial
(
j
).
setEmissive
(
CRGBA
(
255
,
0
,
0
,
255
));
selectedInstance
.
getMaterial
(
j
).
setShininess
(
1000.0
f
);
}
}
selectedInstanceURL
=
instref
.
ContextURL
;
if
(
instref
.
ContextText
.
empty
())
{
if
(
instance_idx
!=
-
1
)
{
std
::
vector
<
string
>
values
;
values
.
push_back
(
"#FF0000FF"
);
EntitiesMngr
.
setupInstance
((
uint32
)
instance_idx
,
keys
,
values
);
selectedInstance
=
instance_idx
;
}
cursor
->
setCursor
(
"r2ed_tool_select_move_over.tga"
);
InstanceId
=
instance_idx
;
if
(
ContextCur
.
context
(
"ARKITECT"
,
0.
f
,
ucstring
(
)))
if
(
ContextCur
.
context
(
"ARKITECT"
,
0.
f
,
ucstring
(
"Edit"
)))
return
;
}
else
{
cursor
->
setCursor
(
"curs_pick.tga"
);
ucstring
contextText
;
contextText
.
fromUtf8
(
instref
.
ContextText
);
if
(
ContextCur
.
context
(
"WEBIG"
,
0.
f
,
contextText
))
if
(
ContextCur
.
context
(
"WEBIG"
,
0.
f
,
contextText
))
return
;
}
}
else
{
if
(
!
selectedInstance
.
empty
())
{
for
(
uint
j
=
0
;
j
<
selectedInstance
.
getNumMaterials
();
j
++
)
{
//unhighlight
selectedInstance
.
getMaterial
(
j
).
setEmissive
(
CRGBA
(
255
,
255
,
255
,
255
));
selectedInstance
.
getMaterial
(
j
).
setShininess
(
10.0
f
);
}
selectedInstance
=
noSelectedInstance
;
}
else
{
if
(
!
selectedInstanceURL
.
empty
())
{
cursor
->
setCursor
(
"curs_default.tga"
);
selectedInstanceURL
.
clear
();
}
}
SlotUnderCursor
=
CLFECOMMON
::
INVALID_SLOT
;
}
}
...
...
@@ -896,7 +884,8 @@ void contextWebIG(bool rightClick, bool dblClick)
CInterface3DShape
*
el
=
dynamic_cast
<
CInterface3DShape
*>
(
CWidgetManager
::
getInstance
()
->
getElementFromId
(
"ui:interface:bot_chat_object:scene3d:object_1"
));
if
(
el
!=
NULL
)
{
el
->
setName
(
selectedInstance
.
getShapeName
());
//TODO: Fix that
//el->setName(selectedInstance.getShapeName());
el
->
setPosX
(
0.0
f
);
}
if
(
selectedInstanceURL
.
empty
())
...
...
code/ryzom/client/src/entities.cpp
View file @
57057b77
...
...
@@ -703,6 +703,57 @@ double CEntityManager::getInstanceColOrient(uint32 idx)
return
primitive
->
getOrientation
(
dynamicWI
);
}
CVector
CEntityManager
::
getInstanceBBoxMin
(
uint32
idx
)
{
if
(
!
Scene
||
idx
>=
_ShapeInstances
.
size
()
||
_ShapeInstances
[
idx
].
Deleted
)
return
CVector
(
0
,
0
,
0
);
UInstance
instance
=
_ShapeInstances
[
idx
].
Instance
;
if
(
instance
.
empty
())
return
CVector
(
0
,
0
,
0
);
NLMISC
::
CAABBox
bbox
;
_ShapeInstances
[
idx
].
Instance
.
getShapeAABBox
(
bbox
);
CVector
bbox_min
;
if
(
bbox
.
getCenter
()
==
CVector
::
Null
)
bbox_min
=
CVector
(
-
0.5
f
,
-
0.5
f
,
-
0.5
f
);
else
bbox_min
=
bbox
.
getMin
();
bbox_min
.
x
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
x
;
bbox_min
.
y
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
y
;
bbox_min
.
z
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
z
;
return
bbox_min
+
_ShapeInstances
[
idx
].
Instance
.
getPos
();
}
CVector
CEntityManager
::
getInstanceBBoxMax
(
uint32
idx
)
{
if
(
!
Scene
||
idx
>=
_ShapeInstances
.
size
()
||
_ShapeInstances
[
idx
].
Deleted
)
return
CVector
(
0
,
0
,
0
);
UInstance
instance
=
_ShapeInstances
[
idx
].
Instance
;
if
(
instance
.
empty
())
return
CVector
(
0
,
0
,
0
);
NLMISC
::
CAABBox
bbox
;
_ShapeInstances
[
idx
].
Instance
.
getShapeAABBox
(
bbox
);
CVector
bbox_max
;
if
(
bbox
.
getCenter
()
==
CVector
::
Null
)
bbox_max
=
CVector
(
-
0.5
f
,
-
0.5
f
,
-
0.5
f
);
else
bbox_max
=
bbox
.
getMax
();
bbox_max
.
x
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
x
;
bbox_max
.
y
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
y
;
bbox_max
.
z
*=
_ShapeInstances
[
idx
].
Instance
.
getScale
().
z
;
return
bbox_max
+
_ShapeInstances
[
idx
].
Instance
.
getPos
();
}
bool
CEntityManager
::
removeInstances
()
{
...
...
@@ -756,14 +807,28 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
}
else
if
(
param
==
"colorize"
)
{
CRGBA
c
;
if
(
fromString
(
values
[
i
],
c
)
)
if
(
values
[
i
]
==
"0"
)
{
for
(
uint
j
=
0
;
j
<
instance
.
getNumMaterials
();
j
++
)
{
instance
.
getMaterial
(
j
).
setShininess
(
1000.0
f
);
instance
.
getMaterial
(
j
).
setEmissive
(
c
);
instance
.
getMaterial
(
j
).
setDiffuse
(
c
);
instance
.
getMaterial
(
j
).
setShininess
(
10.0
f
);
instance
.
getMaterial
(
j
).
setEmissive
(
CRGBA
(
255
,
255
,
255
,
255
));
instance
.
getMaterial
(
j
).
setAmbient
(
CRGBA
(
0
,
0
,
0
,
255
));
instance
.
getMaterial
(
j
).
setDiffuse
(
CRGBA
(
255
,
255
,
255
,
255
));
}
}
else
{
CRGBA
c
;
if
(
fromString
(
values
[
i
],
c
)
)
{
for
(
uint
j
=
0
;
j
<
instance
.
getNumMaterials
();
j
++
)
{
instance
.
getMaterial
(
j
).
setShininess
(
1000.0
f
);
instance
.
getMaterial
(
j
).
setEmissive
(
c
);
instance
.
getMaterial
(
j
).
setAmbient
(
c
);
instance
.
getMaterial
(
j
).
setDiffuse
(
c
);
}
}
}
}
...
...
@@ -782,6 +847,43 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
}
}
}
else
if
(
param
==
"skeleton"
)
{
// TODO
}
else
if
(
param
==
"context"
)
{
_ShapeInstances
[
idx
].
ContextText
=
values
[
i
];
}
else
if
(
param
==
"url"
)
{
_ShapeInstances
[
idx
].
ContextURL
=
values
[
i
];
}
else
if
(
param
==
"move x"
||
param
==
"move y"
||
param
==
"move z"
)
{
float
v
;
CVector
pos
=
getInstancePos
(
idx
);
if
(
getRelativeFloatFromString
(
values
[
i
],
v
)
)
{
updateVector
(
param
,
pos
,
v
,
true
);
}
else
{
updateVector
(
param
,
pos
,
v
,
false
);
}
setInstancePos
(
idx
,
pos
);
}
else
if
(
param
==
"rot x"
||
param
==
"rot y"
||
param
==
"rot z"
)
{
float
v
;
CVector
rot
=
getInstanceRot
(
idx
);
if
(
getRelativeFloatFromString
(
values
[
i
],
v
)
)
{
updateVector
(
param
,
rot
,
v
,
true
);
}
else
{
updateVector
(
param
,
rot
,
v
,
false
);
}
setInstanceRot
(
idx
,
rot
);
}
else
if
(
param
==
"scale x"
||
param
==
"scale y"
||
param
==
"scale z"
)
{
float
v
;
...
...
@@ -879,6 +981,10 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
fromString
(
values
[
i
],
active
);
primitive
->
setObstacle
(
active
);
}
else
if
(
param
==
"col obstacle"
)
{
}
}
return
true
;
...
...
@@ -933,7 +1039,16 @@ CShapeInstanceReference CEntityManager::getShapeInstanceUnderPos(float x, float
bbox_max
=
bbox
.
getMax
();
}
bbox
.
setMinMax
((
bbox_min
*
_ShapeInstances
[
i
].
Instance
.
getScale
().
x
)
+
_ShapeInstances
[
i
].
Instance
.
getPos
(),
(
bbox_max
*
_ShapeInstances
[
i
].
Instance
.
getScale
().
x
)
+
_ShapeInstances
[
i
].
Instance
.
getPos
());
bbox_min
.
x
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
x
;
bbox_min
.
y
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
y
;
bbox_min
.
z
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
z
;
bbox_max
.
x
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
x
;
bbox_max
.
y
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
y
;
bbox_max
.
z
*=
_ShapeInstances
[
i
].
Instance
.
getScale
().
z
;
bbox
.
setMinMax
(
bbox_min
+
_ShapeInstances
[
i
].
Instance
.
getPos
(),
bbox_max
+
_ShapeInstances
[
i
].
Instance
.
getPos
());
if
(
bbox
.
intersect
(
pos
,
pos
+
dir
*
100.0
f
))
{
...
...
code/ryzom/client/src/entities.h
View file @
57057b77
...
...
@@ -236,6 +236,8 @@ public:
CVector
getInstanceColPos
(
uint32
idx
);
CVector
getInstanceColScale
(
uint32
idx
);
double
getInstanceColOrient
(
uint32
idx
);
CVector
getInstanceBBoxMin
(
uint32
idx
);
CVector
getInstanceBBoxMax
(
uint32
idx
);
bool
setInstanceRot
(
uint32
idx
,
CVector
pos
);
bool
instancesRemoved
();
bool
setupInstance
(
uint32
idx
,
const
std
::
vector
<
std
::
string
>
&
keys
,
const
std
::
vector
<
std
::
string
>
&
values
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment