Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
104 stars 83 forks source link

SDK v2 - Behavior action's properties of type animation crash on invalid object types #8066

Open sotano42 opened 2 weeks ago

sotano42 commented 2 weeks ago

Problem description

When setting up an action with properties of type "animation", construct allows you to use that behavior on different object types, no only sprites. If you add a behavior to a tilemap with an action than supports an "animation", it causes construct to crash. You can test this feature on the basic bullet behavior.

In some cases we need to develop behaviors that have handy features that change animations, those same behaviors can be used in many different objects although not all of them support animations. When adding these type of behaviors to objects that do not support animations, construct should simply ignore. A use case will be buttons, 9-patch are an example of an invalid object type. 9Patch and Sprites are both suitable to be used as buttons.

Attach a .c3p

basic-bullet.zip

Steps to reproduce

  1. Add an action to change the animation in the aces.json file image

  2. Add the behavior to an invalid object type, for instance to a tilemap.

  3. Go to the event sheed and call the action, start typing any text.

  4. Construct autocomplete crashes the engine because it is on a invalid object type. image

Observed result

image

Expected result

If the property of type "animation" is on an invalid object, the engine should not crash and simply ignore the action.

More details

Construct Beta r395

System details

View details Error report information Type: unhandled exception File: https://editor.construct.net/r395/projectResources.js, line 555, col 46 Message: Uncaught Error: invalid animations autocomplete Stack: Error: invalid animations autocomplete at uSa (https://editor.construct.net/r395/projectResources.js:555:52) at URa (https://editor.construct.net/r395/projectResources.js:547:294) at HTMLDivElement. (https://editor.construct.net/r395/projectResources.js:3136:292) Construct version: r395 URL: https://editor.construct.net/r395/ Date: Mon Jun 17 2024 12:05:14 GMT-0600 (Central Standard Time) Uptime: 436.9 s Platform information Product: Construct 3 r395 (beta) Browser: Chrome 126.0.6478.62 Browser engine: Chromium Context: browser Operating system: Windows 10 Device type: desktop Device pixel ratio: 1.25 Logical CPU cores: 8 Approx. device memory: 8 GB User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Language setting: en-US WebGL information Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium) Numeric version: 2 Supports NPOT textures: yes Supports GPU profiling: no Supports highp precision: yes Vendor: Google Inc. (NVIDIA) Renderer: ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti (0x00001C8C) Direct3D11 vs_5_0 ps_5_0, D3D11) Major performance caveat: no Maximum texture size: 16384 Point size range: 1 to 1024 Extensions: EXT_clip_control, EXT_color_buffer_float, EXT_color_buffer_half_float, EXT_conservative_depth, EXT_depth_clamp, EXT_disjoint_timer_query_webgl2, EXT_float_blend, EXT_polygon_offset_clamp, EXT_render_snorm, EXT_texture_compression_bptc, EXT_texture_compression_rgtc, EXT_texture_filter_anisotropic, EXT_texture_mirror_clamp_to_edge, EXT_texture_norm16, KHR_parallel_shader_compile, NV_shader_noperspective_interpolation, OES_draw_buffers_indexed, OES_sample_variables, OES_shader_multisample_interpolation, OES_texture_float_linear, OVR_multiview2, WEBGL_blend_func_extended, WEBGL_clip_cull_distance, WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc_srgb, WEBGL_debug_renderer_info, WEBGL_debug_shaders, WEBGL_lose_context, WEBGL_multi_draw, WEBGL_polygon_mode, WEBGL_provoking_vertex, WEBGL_stencil_texturing
AshleyScirra commented 2 weeks ago

Please provide a sample addon demonstrating the issue with SDK issue reports.

sotano42 commented 2 weeks ago

Please provide a sample addon demonstrating the issue with SDK issue reports.

I've attached the addon files.